phy_rotation

The angle of rotation of the instance.

语法:

phy_rotation;


返回: Real(实数)


描述

This variable can be used to get (or to set) the angle of the instances fixture in degrees, similar to setting or getting the image_angle. However note that in the physics world rotations are calculated in the opposite way to the normal GameMaker Studio 2 game world, meaning that vector functions like point_direction should have their return values modified (simply making positive to negative should resolve this).


例如:

if phy_speed_x > 0 || phy_speed_y > 0
   {
   phy_rotation += sqrt(sqr(phy_speed_x) + sqr(phy_speed_y)) /10;
   }

The above code checks the linear speed and if either vector is not 0, it then calculates the actual speed and uses that to set the rotation.


上一页: Physics Variables
next: phy_fixed_rotation
© Copyright YoYo Games Ltd. 2018 All Rights Reserved