phy_collision_x

This read-only array returns the x coordinate of every point detected in a collision between two physics-enabled instances.

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

NOTE This variable does not hold a real GML array, so you cannot run any array functions on it or serialise it (convert it to a string). The only operation you can run on it is accessing a value at an index, with the phy_collision_x[index] syntax.

 

语法:

phy_collision_x[index]

 

返回:

Real (single-precision floating-point value, or undefined if the instance doesn't have physics enabled)

 

例子:

Collision Event

for(var i = 0; i < phy_collision_points; i += 1;)
{
    part_particles_create(global.Sname, phy_collision_x[i], phy_collision_y[i], global.Spark, 5);
}

上述代码在两个启用了物理的实例之间的碰撞的所有定义点处创建粒子。