phy_col_normal_y

Returns the y component of the collision normal for the associated collision point.

Syntax:

GML Code Example

phy_col_normal_y;


Returns: Boolean


Description

This read-only variable returns the y component of the collision normal corresponding to the phy_collision_y array value. For each contact point there is an associated contact normal (which is usually the same normal for all points of contact in the collision). This contact normal is a unit vector that points from one instance in the collision to another, and can be used, for example, to calculate the correct "push" direction to resolve collisions.

NOTE: This variable is only available in the collision event of a physics enabled instance.


Example:

GML Code Example

repeat(5 + irandom(5))
    {
    with (instance_create(x, y, obj_Debris)
       {
       physics_apply_local_impulse(0, 0, other.phy_col_normal_x[0], other.phy_col_normal_y[0]);
       }
    }
 

The above code uses the contact normal to set the direction of movement for an instance created in the collision event between two physics enabled instances.





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