Collision Detection During Runtime

Started by Sal54321, February 13, 2013, 12:34:57 AM

Previous topic - Next topic

Sal54321

Hello, I have a question about collisions.

Is it okay for me to modify the collision mode for a certain object during runtime? For example, let's say there are three objects, call them ObjectA, ObjectB, ObjectC.

I set ObjectA to COLLISION_CHECK_SELF and set ObjectB and ObjectC to COLLISION_CHECK_OTHERS then do  ObjectA.checkForCollisionEllipsoid method call. This way it will be checking two objects for collision. Then, once done, change those three object collision modes to something else, like, ObjectA to COLLISON_CHECK_OTHERS and set ObjectB and ObjectC  to COLLISON_CHECK_SELF and then do ObjectB.checkForCollisionEllipsoid method call. That way ObjectB checks only one object for collision rather than two.

Is this okay or will it cause a performance issue (I won't be just using three objects, it will most likely be three arrays containing objects) or is my understanding of how the collisions work completely off?

I'm asking this because I'm trying to do the least amount of collisionDetection with a decent amount of objects (15+ objects)

EgonOlsen

You can change setting that at runtime, it's cheap.