Author Topic: Collision Detection During Runtime  (Read 781 times)

Offline Sal54321

  • byte
  • *
  • Posts: 4
    • View Profile
Collision Detection During Runtime
« 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)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Collision Detection During Runtime
« Reply #1 on: February 13, 2013, 07:13:19 am »
You can change setting that at runtime, it's cheap.

Offline Sal54321

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Collision Detection During Runtime
« Reply #2 on: February 13, 2013, 11:48:11 pm »
Thanks