Panda Bullet

Using the same code with a different model gets me the correct results.

However, the physics node is 100 times larger then it should be.

By the way, is there a way to specify which bodies should be ignored during raytest? Bullet manual says only about collision masks, so I’m afraid the only way to ignore some bodies in raytest is to iterate over rayTestAll results and filter it manually… Or there are other solutions?

Can you do a self.model.ls() and post the result?
This should reveal the transforms on each node.

The proper way to do it (in C++, sorry) would be to override RayResultCallback::needsCollision and check if the object hit should be filtered or not.

I have not implemented this so far, but it is very high on my todo list. I will probably add an additional parameter to the rayTest methods, which will be a BitMask32.

Cool :smiley:

self.model.ls() returns None.

I have a hudge physics model, with a tiny visible model in the center.

Right, it returns None. But it prints something to the console.

No, thats what its printing.

I am not doing anything to the model other then loading it and reparenting it to the physics node.

It must print something. Even an empty node prints at least one line. Can you put the model somewhere where I can download it, or send it by mail?

Edit:

I found the problem; going into the Blender model, I found that the scale on the model was set to .01. For some reason, although Panda auto scaled the model to match the Blender scale, Bullet did not.

I just finished up a Bullet sim to show working gears!

There is one powered gear, that rotates two unpowered gears.

You will need to add the libpandabullet.dll to the modules folder before running.

Enjoy!

mediafire.com/?b8xl69no92j2bow

Nice demo. :slight_smile:

About the scaling: there is no magic auto-scaling by Panda. All scales which have been set within Blender get exported to the .egg file. When loading this .egg file you create a small tree of PandaNodes, which will have non-identity transforms if there have been non-identity transforms in Blender. Now you pass a single Geom (not the GeomNode!) to mesh.addGeom(geom). A Geom does not know anything about the transforms which have been set on the owning GeomNode or any of the PandaNodes which are the GeomNode’s parents.

Thanks!

Would it not be possible, after I have imported all the geoms, to find out the correct scaling from Panda (since it has the whole model), then auto apply it to the physics mesh?

First you have to find the proper transform, and then apply it to the Geom. Something like this (didn’t test it):

modelNP = loader.load...
geomNP = modelNP.findAllMatches('**/+GeomNode')[0]
geom = geomNP.node().getGeom()

# find transform
ts = geomNP.getTransform(modelNP)

# apply transform
geom.transformVertices(mat)

...
mesh.addGeom(geom)
...

Latest buildbot releases now have Bullet support. Be sure to import the bullet classes like this:

from panda3d.bullet import SomeClass

Great!

I have wondering how to attach to physics bodies to gether.

For example, I would to have a box collision mesh as a lower leg, and attach it to the upper leg by a hing joint.

I also want to play with making ragdolls.

This would be a BulletHingeConstraint. A small warning: I have not tested the constraints well, and there is just one small example showing basic constraint usage. There might be a good deal of bugs.

I would appreciate feedback if you managed to get a ragdoll example done. With such input I could create a C++ convenience class for Ragdolls, and maybe a factory which takes an Panda3D Actor and returns a read-to-use ragdoll.

Awesome!

I think you guys could move the doc which enn0x wrote to the Manual, as it comes with Panda now.

This is already in process. Some of the pages are there already, just not linked to the table of contents. Once the manual pages are halfway complete we will link it.

Okay, I tried the hinge constraint, but found there was no way of moving it around, so its not very practical for joints.

I still know no good way of attaching two physics bodies together.

Here is what I would like to be able to do:

Attach my lower leg physics node to a hinge constraint, and attach the constraint to the upper leg physics node at the position where they should meet. Then when I move the lower leg physics node, it moves the upper leg, and vise versa.