Panda3d ODE collision event

I am very beginner, what does it mean:

def onCollision(entry):
global groundImgChanged
geom1 = entry.getGeom1()
geom2 = entry.getGeom2()
body1 = entry.getBody1()
body2 = entry.getBody2()

I meant geom1, geom2, body1, body2

It is from tutorial and example posted by pro-rsoft( … 07c7b38071), but what is this or where can I find the answer.

Sorry for stupid question

geom1 is the first geom in the collision, geom2 the second geom in the collision, body1 the first body in the collision, body2 the second body in the collision.

Make sure that they aren’t empty before using them. E.g.:

if body1:
  print "body1 is valid and can be used"

otherwise you might get a nasty crash if a geom has no body.

If your a complete beginner ODE is probably biting off more than you can chew, especially as using it involves going off and understanding the ODE manual, however…

ODE consists of two effectively separate, though designed to work together, systems - collision handling and rigid body physics. The rigid body physics simply makes bodies move acording to the rules of physics - Newtons equations basically, whilst the collision detection system handles when things collide.

onCollision is an event that is being called every time two geoms collide, a geom being an object in the collision detection system. The bodies are the associated objects in the rigid body physics system, each controlling their respective geoms. In other words the bodies make the geoms move by applying the rules of physics, and the geoms tell the bodies when they have collided, so the physics can take into account the collision. (onCollision is not involved in this however - that is all being handled automatically by ODE.)

What this practically means is that these objects contain different information - a geom is the shape of an object and its position and rotation; a body also contains position and rotation (not necessarily the same - there can be an offset.), but also includes things like mass, moments of inertia, velocity and torque. If you want to make an object move you do so by applying a force to the body, if you want to make it change shape you update (Well, replace.) the geom. Additionally a body can have multiple geoms, so you can construct a single physically moving object out of multiple chunks of geometry. Also you can have a geom that never moves, and hence doesn’t have a body - this is used for level geometry.

That is a rough idea of what is going on - really, you need to go off and read/understand the ODE manual before you stand much of a chance with Pandas ODE stuff.

Thanks a lot ! I will go for ODE manual and later…will post another question.

. I am already chewing, but still can’t swallow. :smiley: I don’t give up easily!