Game Development Community

onCollision() Not Being Called

by practicing01 · in Torque 2D Beginner · 04/23/2013 (8:13 am) · 2 replies

I'm spawning the same object (a projectile) and sometimes it's onCollision gets called, sometimes not. The times that it doesn't get called there is a visible collision along with the physics effects associated with such. I'm pretty sure the right collision groups and scene groups are set since it both works/doesn't work under the same testing conditions. Any ideas?

#1
04/23/2013 (8:27 am)
Gonna have to see how you create the projectile, clone it, and what the onCollision looks like.
#2
04/24/2013 (6:41 am)
I'm thinking that when an object calls safeDelete() on itself, onCollision won't trigger for objects colliding with it but the physics effects still get processed. Edit: Maybe it has to do with moveTo()?

Code section to create the sprite starts at line 47.

http://pastebin.com/vd7rUUZL