Hello. I’m working with the code “18_Vehicle” This tutorial Bullet for Panda3D: enn0x.p3dp.com/bullet-samples.zip.
I need this car set to roll on uneven ground that I have named “myterrain. egg” . How I can do this? I read the manual of “Bullet Continuous Collision Detection” but I could not solve my problem. Anyone can help me with this code please?
Thank you!
The example uses a simple terrain, a plane. Replace this part with code where you create a Bullet triangle mesh shape (and rigid body) from your .egg file. See the other samples (e.g. 02_shapes) for how to do it.
ok enn0x Thanks. I solved my problem!
But I have another problem. How to add texture to myterrain. egg? I only see the field in “Wireframe”, My myterrain. egg file is assigned a texture, but do not get to appear. Thanks for your help!
I guess that the wireframe you see is not the GeomNode loaded from the .egg file, but the bullet debug render (which shows Bullet collision shapes CREATED FROM the GeomNode). Have you reparented the NodePath returned from the loader to the scene graph?
Ok the problem is that terrain of collision that appears in wireframe not match with my “geom” reparented to “render” or “np” . you need to set the scale of “geom” to match?
The terrain you load is reparented to ‘np’, which is later replace by the Bullet node. ‘np’ might have a transform. Also, only replace if you know what you do. Otherwise use different variables.
This returns a NodePath found BELOW the NodePath ‘geom’. This NothPath might have a transform relative to ‘geom’. You have to use this transform when adding the shape to the rigid body (addShape) or when setting the transform of the rigid body (setPos in your case).
A common mistake is that users miss the fact that a NodePath loaded via the loader might have more than one GeomNode, and a GeomNode might have more than one Geom.
np.setScale(10, 10, 10)
do not scale Bullet nodes. It is possible in some cases, but not recommended. You can either scale the visible geometry AFTER you used it as a blueprint for the collision shape, or scale it flatten the geometry BEFORE using it as a blueprint.