How to handle Collisions events

I have been practicing and perfecting both my python skills and my panda3d skills. I have made a bunch of small programs, and have figured out ODE without much trouble. My problem is not how to do collision detection but how to react to collisions.

Lets say I’m making a game that will have a bunch of submarines going around firing missiles mines lasers etc at each other. I’m trying to make everything Object oriented so I have a torpedo object that loads a torpedo mesh controls it’s AI it’s movement etc. Now how do I handle when it collides with a sub? I want the torpedo to explode and the sub to take damage. I’m using ODE so I know I have a collision call back but I do not understand what to do in it.

Should I be doing something like having each object have a hit function that would take the name of the object that object collided with for example the torpedo hit would be something like

def hit(self, contact)

Hopefully someone understands what I mean by this, and understands what I am struggling with. I have done a lot of research and believe I have read every forum post with the word collision. I have done various google searches for game collision architecture etc. But have come up empty. Any help or articles you could point me to would be greatly appreciated.

I don’t see anything wrong with that method.

It really depends on how you organize your objects. This is the glue between the low-level collision detection and your abstract organization of virtual space entities.