Collision Detection help

Hi, I need a little help with collision detection because everytime I try to do it it doesnt work

  1. how to actually apply the collision detection to the object
  2. is the collision flag set in panda or the 3d modeling software!

how can apply collision detection to the whole object

if possible, please do an example here:

  1. have two objects a plane and a sphere

  2. have simple input to the sphere just forward and backward

  3. thats about it

There are, I believe, a couple of ways of going about both the representation of the object for collisions and the handling of collisions.

Firstly, Panda includes a set of collision solids (such as spheres); these are probably (although I stand for correction on this) better choices than model-based collision geometry, the detection being, I suspect, a bit more robust. In particular, you may find that you can use collision spheres more often than you think (for example, if creatures only really move in two dimensions, then spheres may well work better and be more efficient than geometry that more accurately represents the creatures, since most of that geometry has little real relevance).

These objects you create yourself and manually add to the scene graph, I believe.

On the other hand, you can also tag geometry generated in your modeller to be collision geometry. For efficiency reasons, this should probably be rather less detailed, using rather fewer polygons, than the visual representation of the object that it is supposed to provide collisions for. In most cases I sincerely doubt that you’ll notice the difference unless you’re looking for it (and possibly little, if at all, then).

This type of geometry is automatically added to the scene graph as collision geometry when the model is loaded and added to the scene graph, I believe.

In other words, the answer to question two is “either: it depends on your desires”, I would say.

In terms of handling collisions, I suggest looking at collision handlers. If you just want to keep objects out of walls, floors and each other, then I suggest the CollisionHandlerPusher, which takes a reference to the object to be pushed in the event of a collision (such as the player actor, when setting up the collisions of the player’s collision geometry).

Don’t forget to add your “active” collision objects to your traverser!

Finally, have you read over the collision detection section of the manual? It might help you to figure out how to do things. I recommend starting off by implementing just what you asked for as an example, in this case using Panda’s collision primitives, specifically CollisionSphere and CollisionPlane, and keeping the former from passing the latter with a CollisionHandlerPusher.

Finally, note that the manual includes examples of collision detection, as I recall - those might be of use to you. :slight_smile:

yeah roaming ralph confused me lol I understood xna more than i did collisions i dont know maybe its the programmers lack of proper commenting or something idk i just couldnt get it and THANK YOU THANKYOU i didnt even know collisions was in the manual and I EVEN SEARCHED FOR IT i feel so stupid! lol and the manual does explain it better than roaming ralph but yeah ill go read the manual now lol :slight_smile: thanks alot oh one more thing…i asked but nobody responded…is there a printable version of the manual a pdf maybe b/c i downloaded the manual and its nothing like the online manual or maybe firefox is putting it together wrong…but that would suck b/c im on linux and thats all i use :slight_smile: goooo linux

It’s my pleasure - I’m glad that you would seem to have found what you’re looking for. :slight_smile:

As to a printable version of the manual, I’m afraid that I don’t know of one. :confused:

If you just want offline access, however, you might be able to use a site-download program to download the entire manual.

A downloadable copy of the manual is made available at each major release. The most recent one is here:


then you should clarify instead the title from the downloads page says panda3d manual i put it in bold b/c thats the way it appears on the page and then under it says reference? so that isnt the manual then? thats confusing so you should maybe fix that to prevent such things :slight_smile:

Well, in their defence I’m inclined to argue that a manual is a reference document. :wink:

Of course, the presence of a separate “reference” link on the top bar could indeed be confusing to some, I would imagine, true.

There are two different things: and is a copy of the API reference section (accessible under the “Reference” tab above), and is a copy of the Wiki manual (accessible under the “Manual” tab above).

There is a copy of with every release, but is only provided with the major releases (e.g. 1.5.0, 1.4.0, and so on).

I don’t know why there’s not a on the minor releases too. I guess Josh figured it didn’t change enough to justify that.


what i mean by this, believe me I’m not complaining I love the manual, but if you download the reference its NOT anything like the manual it references everything in panda and doesnt really implement in it. basically the manual is a hybrid references with tutorial while the reference is only to tell you about the functions not explain how to use them you might wanna download for yourself and see what I mean

Aah, fair enough, then. My mistake. :slight_smile: