Oimo.js icon indicating copy to clipboard operation
Oimo.js copied to clipboard

Triggers and Sensors?

Open gregmax17 opened this issue 8 years ago • 1 comments

Apologizes in advance for repeating myself, I'm just really looking forward to answer.

I'm continuing off of this issue here: https://github.com/lo-th/Oimo.js/issues/61

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?

gregmax17 avatar Sep 19 '17 04:09 gregmax17

Apparently I came up with a solution that seems to work at least for the time being. I added a flag 'isTrigger' to the RigidBody and modified World.js at line 530 adding another condition:

if(( b1.isDynamic && !b1.sleeping || b2.isDynamic && !b2.sleeping ) && (!b1.isTrigger && !b2.isTrigger) ) contact.updateManifold();

By doing so the body doesn't physically react to collisions, but still trigger contacts.

@lo-th Do you think it could affect your code elsewhere?

erosmarcon avatar Jan 19 '18 13:01 erosmarcon