Game Development Community

Check if a object is collided?

by Edoardo · in iTorque 2D · 04/11/2011 (6:18 am) · 3 replies

Can I check if a object is collided?
I know the onCollision function but I would ask "on-demand" if a object is collided..

it's possible?

#1
04/11/2011 (6:46 am)
CastCollision is likely what you want to use.

Question is what you hope to gain for it cause it will cost more performance than if you use the onCollision thats fired anyway and set a simple state on the object like .collideWith = %otherObject and when it does not collide anymore you unset it, then you can just check if it is set or not to find out if and with what it collides etc
#2
04/11/2011 (6:55 am)
Thanks Marc...

The .collideWith variable is a good idea but when the object is out of collision How can I unset the variable?

I've only the onCollision callback...

I do not want to use the triggers for this thing...
#3
04/11/2011 (9:13 am)
Could set a schedule or use the onupdate callback.