phy_rotation

The angle of rotation of the instance.

Syntax:

GML Code Example

phy_rotation;


Returns: Real


Description

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 game world, meaning that vector functions like point_direction should have there return values modified (simply making positive to negative should resolve this).


Example:

GML Code Example

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.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here