Author Topic: Collision detection  (Read 1958 times)

Offline abhi13feb

  • byte
  • *
  • Posts: 37
    • View Profile
Collision detection
« on: April 23, 2008, 07:41:22 am »
How sphere polygon collission detection has been carried out in jPCtDemo example.Can someone plz explain it briefly..thanks

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Collision detection
« Reply #1 on: April 23, 2008, 01:21:24 pm »
Basically on the objects you want to test for a collision you call

object1.setCollisionMode(...); I suggest using the or operator for Collision detect self and others
object2.setCollisionMode(...); same thing.

Then you need to implement the collision listener interface, and call

Code: [Select]
object1.addCollisionListener(new YourCollisionListener());
Then when you want to test if a movement will create a collision you call
If you object collides with another object the collision method will be called in your listener.

Its pretty much how the Swing event system works. Hope this helps!