How to use dynamic rigid bodies that are parented to a RigidBodyCombiner

I was experimenting with using the RigidBodyCombiner class to combine some dynamic rigid bodies However, The bodies lost their gravity and became kinematic. The fps did increase, but the bodies were no longer able to move with linear forces and scaling and other transform options no longer worked. Is there a proper example I could use to get dynamic rigid bodies working?

To the best of my knowledge, the RigidBodyCombiner isn’t intended for use with physics; rather it’s intended to reduce the number of visual meshes being sent to the graphics card to be rendered. (See this manual page for more detail.)

As such, applying it to physics objects may well indeed break those physics objects.

(While the name is similar to that of the “BulletRigidBodyNode”, I imagine that this simply reflects that both work on non-animated–i.e. rigid–meshes.)

As to your physics objects, let me ask: what is your intended goal in combining them? Perhaps another approach might be found that will help!

I have found the problem with the physics not working. I set up a Bullet Debugger to see the rigid bodies in action. They seemed to work perfectly fine. The problem turned out to be the models / geometry nodes that were parented to the object that were not updating their transform with the rigid body.

The fix to the solution is weird. What worked was setting the rigid bodies position to any other Vec3 position that was not at 0, 0, 0.

I suspect that the issue is with the Rigid body Combiner’s node path being at 0, 0, 0. I tested this and this turned out to be true. The node path for the Rigid body combiner (as described in the manual) interferes with the parenting of the model to the rigid body. I will try and work on a solution now.

One solution is not to use the hierarchy of objects as suggested by Bullet, just to map the transformation of objects for rendering (NodePath) to solid physical bodies in the task, by analogy with ODE.

Another solution is to set the Rigid Body Combiner’s position to an astronomical value that will, in theory, never be reached while using the scene. This would also mean that when moving node paths parented to the Rigid body combiner’s nodepath, I would have to deduct the position while using setPos() func.

Could there maybe be some fix done to this issue internally to panda3d?

I found that the best way to deal with the positioning issue is setting one of the 3 axis values to a number like 0.0000000001. The nodepath when set to this value, fixes 2 problems. One: the physics works again; Two: Nodes, when parented to the he path, return with LPoint3f(0, 0, 0) when using the getPos() function. This means no interaction is needed with positioning child nodes.

1 Like