Collision Callback with receive collisions only
by Peter Robinson · in Torque Game Builder · 03/07/2007 (10:33 am) · 21 replies
I'm having a problem. I want to call the collision callback on an object without sending collisions from the object. As far as I can tell, you have to set the send collisions to true before the callback will be called. I would LOVE to just be able to set the call back to true and the receive collisions to true. Basiclly I want an object that will know when other objects are passing through it but won't affect the other objects in any way. Right now if I turn just the send on I get two collisions (one where the object is src and one where its the dst) and if I turn just the receive on I get nothing. If I turn them both off I get nothing. Is this the intended behavior? I would guess that if you have just the send on you would get one collision with the sending obj as the source and if you turned just the receive on you would get one collision with the receiving obj as the dst. Is there some way I can tweek these things to get my desired behavior? Thanks!
-Peter
-Peter
About the author
A programmer who has been using the Torque2D game engine since the early adopter days. My game is Pirate Code and it can be found at www.circuithive.com. It will be arriving on Steam in 2016.
Torque Owner Clint Herron
If you want an object to pass through another object, but still want notification when they touch, I would recommend that you use a separate trigger mounted to your sprite object, and turn collisions off altogether for the sprite itself (at least between the player and the pickup item -- your item sprite can still collide with the world and have physics enabled, just don't let it collide with the player -- let the trigger notify you of that).
In the OnEnter callback from the trigger, check to see if the player has the item required to do a pickup. If not, then don't do anything.
--clint