i have 2 object a car and a road, the road is univane so i need a floor collision handler for the car to stay on the road but i coudnt realy undersand how to do it from the manual .
can someone plse explain to me how to do it or give me a code example
You can explore the demo “roaming-ralph” in the “samples” folder. In order to understand how it works.
Or use a physics engine, for example: bullet or ODE.
i tryed to leard form that example but whan i tryed to change to map to my own model it didn’t ditacted to collision
If you decompress the world.egg.pz file and look at the contents.
Then you find the line:
...
<Group> terrain {
<Collide> { Polyset keep descend }
...
Where the name of the group is “terrain” and the
<Collide> {Polyset keep descend}
tag, respectively, you need to respectively specify a similar tag in the model of your road.
In the code, change the “roaming-ralph” line:
if len(entries) > 0 and entries[0].getIntoNode().getName() == "terrain":
The name of your road, for example: replace “terrain” with “road”.
An offer for developers to get rid of this check. Since it is meaningless and confusing.
if len(entries) > 0 and entries[0].getIntoNode().getName() == "terrain":
if len(entries) > 0 :
this wasn’t the problam ,the problam is thant the entries list was allways empty
In view of what you say without specifics, it is difficult to understand you.
i chaged the file from the world model to a .x model i had to see if it will stil work , but the entries list is empty
Does your model have collision geometry in it? (This is usually a separate model–even if in the same file–from the visual geometry.)
If you are talking about DirectX format, then this is impossible, you need to open it in a blender or another editor that supports egg, and set the tag for the collision and save it as an egg. You can also try to convert to egg using utilities. Everything you need can be found in the bin folder of Panda3D.
what tool is used to decompress an .egg or .egg.pz file? I’ve looked for this but can’t find. Thank you.
would you mind describing the step(s) to mark a mesh for collision in blender? I’ve looked around the forum here but it seems the info might be out of date, I’m not sure. Thank you.
I’m presuming that you’re using Blender 2.78, or that your version is similar to mine in the elements that I’m about to describe.
With that noted, if I’m not much mistaken the following should work:
If you have the mesh open in Blender, open the “Logic Editor” view. If the “Properties” panel of that view isn’t open, open it (by pressing “n”, or clicking on the little “+”-sign on the right of the view.
In the “Properties” panel of the “Logic Editor” view, click on “Add Game Property”. This should produce a new property below the button, with three elements. From left to right, these elements are the property’s name, type, and value.
To mark a mesh as a collision mesh, set the name of the property to “Collide” (without the inverted commas/quotes). If the type is not already “String”, set it to that. And finally, set the value to “polyset descend”.
(If you want to also use the mesh for visible geometry, add “keep” to the above value.)
Now, if you export your model from Blender via YABEE, the resulting “egg” file should have a collision mesh within it.
https://www.panda3d.org/manual/?title=FAQ
I installed Panda3D through the installer in windows, and found that this utility is embedded in the context menu. Which is very convenient.
If on Windows, you can create a shortcut for punzip.exe, which you will find in the “bin” folder and simply drag and drop onto the shortcut of the .pz file to decompress. You can also compress, for this you need to create a shortcut pzip.exe.
thank you for the links, very helpful!
how does one look at the contents of an egg file (code)? Is this performed using EggData module and if so what is the proper call, read()? Thank you.
Nevermind, I don’t know why I was unable to open in notepad before… this makes things a lot easier! Hehe.
i tryed to convert the directx to egg using the x2egg progame that in the bin folder but i lose the textures
Please note that this is not critical, you do not need a model with textures for collisions. You can use the DirectX file for visual display and the egg file for collision.
As for texture loss, can you post a sample of DirectX and eggs? to be able to figure out the cause. Perhaps you need to fix the path to texture.
We do not recommend using the .x format for getting assets into Panda3D. If you are using Blender, the most reliable way is to use the YABEE exporter.
I would like to argue against this approach. At the moment, working with panda resources is not correct and misleading. And the reason for this is the use of the egg file as a container for other information that is not related to geometry for visualization.