www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Sal54321 on February 13, 2013, 12:34:57 am

Title: Collision Detection During Runtime
Post by: Sal54321 on February 13, 2013, 12:34:57 am
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)
Title: Re: Collision Detection During Runtime
Post by: EgonOlsen on February 13, 2013, 07:13:19 am
You can change setting that at runtime, it's cheap.
Title: Re: Collision Detection During Runtime
Post by: Sal54321 on February 13, 2013, 11:48:11 pm
Thanks