Game Development Community

OnCollisionEnd (does it exist?)

by Luis E Pabon · in Torque Game Builder · 07/13/2012 (3:22 pm) · 2 replies

I am having difficulty implementing some collision code for a game, and I was hoping to set an object's property to change whenever they stop being touched by the player. A quick search didn't give me any results, but I am sure there's an implementation or workaround somewhere in the forum. Any help would be appreciated.

#1
07/16/2012 (1:13 am)
Instead of using a collision callback, mount a trigger object to your player. You'll then get an onEnter and onLeave callback for any objects that collide with the trigger. Remember to turn on collisions for the trigger (but turn off send/receive physics) for the callbacks to register.
#2
07/16/2012 (10:58 am)
There is no enter/leave collision calls for scene objects, to put your mind at rest on that issue. :(

so maybe something like @Conor suggests

or, like me, just try really hard to get what you want from collision detection. it'll require lots of unnecessary calls into onCollision, where you can test state variables to remember this particular thing has already been in contact and so forth. if you don't have too many cases of this, and if it is one of the main elements in your game, it should be a justifiable cost.