lo-th / Oimo.js

Lightweight 3d physics engine for javascript
http://lo-th.github.io/Oimo.js
MIT License
3.05k stars 301 forks source link

Collision and Trigger Events/Callbacks? #61

Closed gregmax17 closed 7 years ago

gregmax17 commented 7 years ago

How do I determine when 2 bodies collide, is there a callback? Also, another part to that, is there way to detect when 2 bodies to be behave like triggers, is there a way to get a callback event but not have the bodies collide?

What are the available callbacks for this?

lo-th commented 7 years ago

http://lo-th.github.io/Oimo.js/index.html#rotation

gregmax17 commented 7 years ago

Thanks you for response. However, I fail to see how this answer my second part of my question: having the bodies behave like a trigger.

Is there a way, in that example, to have one of the spheres turn to the green material while passing through their box, respectively?

Imagine in a first person shooter the player walks through a doorway to go into a room full of monsters that spawn upon entering. In that door way as the player collided with a box trigger there was no actual collision but instead a callback/event for me to start spawning monsters. Make sense?

Is there a behavior like this available?