Collision detection in Blockly

To detect a collision between two objects using Blockly you can use the “on collision of item with another item” block from the “Events” tab like in this example:

blockly

The code in “enter” will be executed once when the sphere is colliding with any other item in the scene. Whereas the code in “exit” will run once when the sphere isn’t colliding anymore with the other item.

blockly-collision

3 Likes