Panda3d Collisions made simple

that crossed my mind - your inquiry uncovered indeed a hole in my snippets that definitely need to fill - I’m actually going to end a couple of new snips, then I’ll add a new one ASAP talking about your issues.

today I reorganized the whole stuff to be splitted in beginner and advanced so those who already got a little startup in collision could jump the first part - then I added a couple of new snippets showing out how to use the isInView method as a cheap way to fake collision detection of objects falling inside a frustum. Go up and grab’em out

as requested by Ogga I made a 2.5D collision sample - it is a whole level of a imaginary game - Plz don’t blame the author for not to be a great level: it is just for learning purposes. :wink:
as usual go on top to grab it

I’m going through the exercises but I’m stuck on the first one. When I run the program with my own egg I get the error “!collider is empty…”.
I’m converting from 3d max 2010
my egg file reads as :
{ Z-Up }

character {
{ 1 }
“Scene Root” {
Sphere01 {
Sphere01 { Sphere descend keep }
Sphere01.verts {
0 {
6.9763 1.23258 14.0568
{ -3.29839e-008 -1.49672e-008 1 }…
please help

well, at a first glance looks you aren’t respecting the same model construct - in all my steps I ain’t never used the ‘keep’ keyword therefore I use to have a visible geometry mesh and a collider mesh and do not use a single mesh for both tasks - that’s why my script gave you words.
The problem is that I conceived the whole stuff following the modeler sources as well and to go with blender not max so if you’re going to follow this path I suggest you to down blender in your PC (it’s free after all), open the .blend model source for the step your digging, see what inside and try to reproduce the same object structure.

First - Thank you so much astelix for creating these tutorials! They have greatly sped up my learning of Panda3D collisions. :smiley:

Second - I’m having a problem with my geometry and ‘Polyset descend.’ I’ve got a scene in Blender with 5 pieces of collision mesh and they are all parented together like this:


  • collide2
    • collide3
      • collide4
        • collide5

Each one has the property Collide, ‘Polyset descend.’ Unfortunately, only the first collide1 works and my character walks through collide2-5 without triggering a collision. I’m setting up the wallcollider like it was done in the intermediate step2 example:


Any idea what I’m missing?

yep, you’re missing the advanced step2 :slight_smile:
you’re going to do something advanced - but correctly made - that I hinted in that step (to be precise in the windmill.blend “Notes On Making Of”). Anyhow it is a chicken exporter limitation - it recognize and export correctly just the first nesting level therefore what you’ve done it is not correctly exported.

Hello Astelix,

Your code did help a lot. I can imagine the time it took you for writing it. Thanks a lot for that :wink:

There’s something which I find hard to understand in the step4 of the collisions advanced exemple. The automation you wrote is confusing me…
Well, I guess I’ll pass my afternoon on that :slight_smile:
Thanks again…

happy to see you fellas found this stuff of some use

hello there. well it took less time one could expect - while digging this stuff and making more and more confy with it you’ll see as well yourself making complete minigames in a snap.

what in particular is bugging you out?

Well, it’s only me not completly accustomed to python :slight_smile:
Particurarely with these lines :

  'normal': {'egg': 'groundc', 'rootname':'normal-root', 'collider': None},
  'oc3fied': {'egg': 'groundco3', 'rootname':'octree-root', 'collider': None},}

def oc3_floor_collider():
  snipstuff.infotext['message'].setText("Using ocreefied collision mesh")

snipstuff.DO.accept('2', oc3_floor_collider)

you know what? for a long minute I stared that code without getting why I wrote it and how it worked out so I decided to rewrote that piece but before to repack the whole stuff I need your opinion to know if this time is understandable even for foreign eyes - I shared the here so you may grab and see it and please then report back here.

Yep. Much more understandable :wink:

good - soon I’ll repack the whole stuff with that and also with the final 2 steps concerning ballistic that should close this tutorial.

I am affraid for you that you picked up an endless topic which will take you much more time!

If I may suggest to rename your .py files from “” to something more eye catchy like “”. And “” by “”. (well, I already did it on my computer).

Can’t wait to see that Balistic topic :slight_smile:
Did you scheduel to publish something concerning physics ?

I prefer this lazy naming because I always seeing myself restructuring the situation while adding stuff - it is indeed the 3rd time I remade it so naming like you suggest just make no sense to me - you may shuffle that stuff to suit your needs, though be advised that the next package will be differently shaped again so I see you renaming again the whole stuff :slight_smile: My piece of advice is just to keep the first post of this thread aas reference to know where the stuff is and you may always save the whole page with your browser to see it offline.

the ballistic topic is indeed related to physics - just don’t expect too much from that: it will be just a starting point and also panda physics is a very basic physics engine. This is why I planned to start soon another stepped tutorial digging ODE, so stay tuned.

ok here you go the last tutorial pieces related to panda physics and rapidly moving collisions - with these 2 steps the tutorial virtually finishes here but anyhow I’m always here listening enquires and issues.
Go up to snatch the last stuff and enjoy.

This may seem like a noob question, probably because I am new to this but, how do I look at the Blender Source code? So far I have seen 2 references to changing something in the .egg and I’m not sure how to go about doing that. Any help would be great, thanks.

simple as it sounds: you have to install the Blender 3D editor - drive your browser here, download Blender for your system and install it.

I have Blender installed and it is what I have been using to make all of my models (UV unwrapping is a bitch). But how in Blender do I see the code part of the file?

well I’m not sure I’m getting what you’re asking for referring to “Blender Source code” or change something in the egg - there is no source code to see in Blender. Then, everything you should need to know related to the snippets is in the text comment I provided in the blender sources. Try to be more specific and point me the blender source, the snippet and the code you find hard to understand so I’ll be able to help you better.