Author Topic: Collision Information. Who collided with what  (Read 2424 times)

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Collision Information. Who collided with what
« on: October 01, 2011, 09:35:32 pm »
Hi Egon,

I've been looking through the forum and the Wiki for this, apologies if it's already been asked. Basically the checkXXXcolision method is very helpful for modifying the direction of the object in case a collision occurs, but is there a way to get information as to what object I have just collided with? So that for e.g. some action could be performed on such object?

Thank you very much!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Collision Information. Who collided with what
« Reply #1 on: October 01, 2011, 10:02:07 pm »
There's a collision listener interface. Just implement that, add an instance of it to the Object3Ds in question and you'll get the information you asked for when a collision happens.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Collision Information. Who collided with what
« Reply #2 on: October 02, 2011, 08:19:35 am »
Sorry to somewhat steer the conversation, but I'll say this again: it would be REALLY helpful to get something like static void drawSphere(SimpleVector pos, SimpleVector size) and static void drawEllipsoid(...) (perhaps inside of the CollisionEvent class itself) to allow us to visually see where our collision objects are.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Collision Information. Who collided with what
« Reply #3 on: October 02, 2011, 09:10:16 pm »
That won't work. To draw something in jPCT, it has to pass the pipeline, i.e. it has to be part of the world and such. You can't initiate immediate draw commands...except for blitting, but that's another story.