Panda3d Collisions made simple

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 :

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

def oc3_floor_collider():
  floorcolliderdata['oc3fied']['collider'].node().setIntoCollideMask(FLOOR_MASK)
  floorcolliderdata['normal']['collider'].node().setIntoCollideMask(MASK_OFF)
  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 step4.py 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 “step1.py” to something more eye catchy like “1FloorCol.py”. And “step2.py” by “2WallFloorCol.py”. (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.

Sure thing, anything to get help.

In step one of the beginners package you said “look into the blender source (if you ain’t so far) to know what I mean” in a comment on line 49. How do I “look into the blender source”? It also said in one of the panda examples to go into the .egg source and look for anything with . Where do I get to look for the .

Note that an egg file is just a text file, and you can view and modify its contents in any text editor, including Notepad. If the file is named egg.pz, it’s compressed, and you can uncompress it with the program punzip.

David

ah ok - I never thought that words would confuse ppl, but that’s a beginner step, so if a beginner as you claim yourself get confused, I guess I’d to change that in: “open the file named ‘models.blend’ from the collisions-beginner folder”. That’s is what I meant with ‘source’, admitting is not the best word though.
Referring to .egg I mean the model’s file format panda3D uses to load - it is what you got when you’ll export your model off Blender and that is something a beginner should know from panda3D basics. As I always suggest to the first panda3D beginners, read the whole manual from start to end at least once, even if you won’t get everything befor to put your hands on the panda3D engine, then start to do some - panda3D is not quite a n00b package so it needs a little startup effort before to start doing something. Hope that point is clear now but inquire me otherwise with no fear - after passing by the manual though
:wink:

ok I update the package(s) - MMichaud I suggest you (and of course the other ppl) to download again the whole stuff cos I found some other inconsistencies to be up-to-date.

Also check out the Logic panel in Blender ( F4).
This is where you set some of your objects to act as collision geometry.
@Astelix: nice job. A lot easier way to learn collisions than RR sample.
How about adding the line

avatarNP.setBillboardAxis()

or other billboard effect to the jumping minigame?

if youre rferring to the windmill minigame I guess I can’t apply that to the avatar - dunno if happened to you playing to fall your avatar off a certain heights but if you do you’ll see I need the avatar to stay stick parallel to the ground so I guess using billboard I shouldn’t get the same effect.

Minor changes applied:
addeed a step0, a very easy and minimal introductory snippet for real noobs with whatsoever knowledge of collisions - just to break the ice.
Alsp lighted down AMAP the package file sizes, really squeezing bytes for those fellas with bandwidth shortage. the intermediate package is still no less than 5MB but really can’t go down more.