Collision

Revision as of 19:07, 16 May 2024 by Nikitaivanov (talk | contribs) (Created page with "Checks the collision properties of the input object. Input: * 1st Object: The object that will send the collision data to this script. Output: * Collided: Triggers when the input object collides with another object, including the floor. * 2nd Object: The object that the input object collided with. It outputs "None" if collided with the floor. * Impulse: The impact force of the collision (how hard did they collide). Specifically, impulse is a change of momentum of an ob...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Checks the collision properties of the input object.

Input:

  • 1st Object: The object that will send the collision data to this script.

Output:

  • Collided: Triggers when the input object collides with another object, including the floor.
  • 2nd Object: The object that the input object collided with. It outputs "None" if collided with the floor.
  • Impulse: The impact force of the collision (how hard did they collide). Specifically, impulse is a change of momentum of an object.
  • Normal: The direction of the impact from the 2nd object to the 1st object.

File:Collision1.png

Notes

  • If you're colliding with multiple objects it'll report the most forceful collision.
  • If you're overriding physics to move objects (using Set Position) then no collisions will occur.

Examples

The script below causes you to win if the two physics boxes collide with each other.

File:C1.png

Because the ground counts as "None", the script below causes you to lose if the sphere touches the ground.

File:C2.png

Triggers a sound effect only if the impulse is big enough.

File:20210103 135824.jpg