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.