Detecting Collisions Between Two Specific Objects

Hi folks, I would like to know if it’s possible (and if so, how) to detect collisions between two specific objects, instead of merely detecting any collision with any object.

To detect a collision with any object and have such a collision trigger a function, I would have been using this in my entity.prototype.initialize function script:

this.onTriggerEnter, //Function to call

However, I do not know how to detect when two specific objects collide, such as in the case of, where I need to be able to differentiate a collision with the side walls and a collision with a moving box (for the Sphere), and run certain functions when the moving box touches the sphere. How, and can I do that?

Thanks in advance.

Have you looked in documentation about other events there are for collision component?

1 Like