Contact detection between objects or layers

I think it is a beginner question.
What is the best way to detect the contact between two or more objects or layers ?
As example: Two dice fall to the ground and collide and jump in different directions
depending on the edges as they touch.



Hi, Rolf. There’s a feature request that would be very helpful, but is still open for voting (not yet implemented): Physics Simulation: Collisions (rigid-body).

1 Like

In the meantime, you might investigate Vuo’s “Is Within” nodes. Thanks for trying out Vuo!

1 Like

Here’s a composition that demonstrates a rudimentary way of detecting collisions. It doesn’t deal with objects bouncing off of one another. That, I leave to you, though I’d wait for the physics simulation nodes if I were you.

The synopsis: Two rectangular layers float about the screen. When when one rectangle’s vertex enters the other layer, a collision is “detected” and a collision message is flashed on the screen.

Note: This registers extra collisions in cases where the two layers overlap, but all eight vertices happen to be outside of their opposites’ rectangle. Think of two rectangles that overlap to form an X, then one slide off the other. One could improve things by also checking, say, midpoints along the edges, and further by adding more points to check, though there’s a point (pun unintended, but I’m not changing it) at which performance will suffer.  

Collisions - Look out.vuo (24.6 KB)

Those captions :)

Many thanks Philip, this is a great base for me!!! :