OnCollision callback not working
by Joe Williams · in iTorque 2D · 07/30/2010 (4:31 am) · 6 replies
I'm at my wits end, here. I have "Callback" checked under collision for my main object in my game, I have it set to send collision, and I have a ground object for it to collide with set to receive collision. The main object falls to the ground and stops on it, but the onCollision callback isn't actually being called for some reason. Right now I just have the callback set to output a debug string saying "colliding," and it isn't happening. Does anyone know of an obscure reason why the onCollision callback might not be called? I have the update callback enabled. Is that the problem? I've never had a problem with onCollision before, so I'm getting really frustrated with this.
Edit: Just to add more info, yes I have "setUsesPhysics( true )" in the object's onlevelloaded function.
Edit: Just to add more info, yes I have "setUsesPhysics( true )" in the object's onlevelloaded function.
About the author
Recent Threads
#2
07/30/2010 (2:07 pm)
It's on the sender, though I've tried it with both. I've also made sure that my call to the debug text function is working. If I put it into any other function, the debug message appears every time that function is called.
#3
07/30/2010 (2:59 pm)
Check that you haven't clicked any of the collision layers or groups buttons.
#4
07/30/2010 (3:20 pm)
I have the collision layers set so that the sender collides with the receiver's layer and vice versa. The main object falls until it it hits the ground, and then it sits there. So I know they're colliding. The callback just isn't being called.
#5
07/30/2010 (3:35 pm)
and the datablock is configured correctly assuming you do it through a datablock based methods?
#6
08/18/2010 (10:38 pm)
Turned out there was a string in my code, shortly before the onCollision callback, that was causing the error "string always resolves to 0" or something like that. This somehow prevented the onCollision code from executing. Anyway, problem fixed.
Associate Craig Fortune