Panda Bullet


Hi! Finally I had the time to try the new CTOR and it perfectly solved my problem! Thanks for your great help!!


I am trying to simulate an accelerometer. Right now, I am storing the current angular and linear velocity of the concerning primitive in every time step to be able to calculate the acceleration of the body if desired. Unfortunately, this slows down the simulation considerably. From a short look at the Bullet source code, it seems like I could calculate the relevant variables directly if the following methods would be wrapped by Panda:


This would give me the possibility to only do calculations when the acceleration is really desired.
Is there any change you might find time to expose those to the python interface?

Thanks for your great work and hopefully your help!


Hi again,
I decided to add the four getters myself. If someone gives me a hint which file extensions are allowed here (I keep getting “The extension ### is not allowed.” for all ###s I tried) I could upload a patch file.


I exposed all off the requested methods. However, I’m suspicious that it is not getInvInertiaTensorWorld what you need, but getInvInertiaDiagLocal.

The file extensions you asked for are “.h”, “.I” and “.cxx” for C++ files. The files which had to be modified are in the Panda3D source code, path “panda/src/bullet/bulletRigidbodyNode.h/.cxx”. I have no idea what you did try to add the getters yourself, and who gave you the “extension not allowed” messages.


I seem to be encountering an issue with the Cone Twist Constraint:

I have a cylinder that I want to have constrained to a point in the world using a Cone Twist Constraint. Based on what I’ve read, the way to do this is to make a reference frame using “TransformStage.makePosHpr”, provide the desired position as the first parameter (and any desired rotation as the second), then construct the constraint with that reference frame and the desired object as the second and first – and only – parameters.

For the most part, that seems to work… except for the fact that it seems to ignore any y-offset that I give to it. Changing the position passed in to “makePosHpr” seems to have an effect: the debug renderer shows a small cone at the desired point. Further, changing the x- or z- coordinates of said point do seem to result in the object being drawn to the appropriate x- or z- coordinate. Changes to the y-coordinate, however, seem to be ignored: if I place the object at the desired position it slides back to the origin on the y-axis, and if I leave it at the origin it stays there.

In case any of the following is relevant, I believe that I’m using Panda 1.8.0 under Ubuntu Linux 12.04.

Does anyone know what might be going wrong? :confused:


Thanks for your help!

I modified the files you mentioned and created a patch file which I planned to make available to you. Therefore, I tried to attach this file to my last post in this forum. The forum, however gave me “extension not allowed” with every possible file extension I tried.


Ok… got you now. And thank you for helping. I think renaming the patch files to something which is supported by PHP Forum, and then putting a comment alongside which give reader a hint about the correct file extension might have worked.


My fault. I missed to expose methods which allow to modify the OTHER frame, that is in case of constraints which connect one body to the word the “world frame”. So far the constructor allowed to specify the frame of the rigid body relative to the constraint vertex point. But there has been no way to tell Bullet where this constraint vertex point should be. I have exposed these methods now: in Bullet it is “constraint.setFrames(frameA, frameB)”.

A quick example: Assuming you are using Panda3D’s default coordinate system ZUp, and want to have a lamp which is hanging down from a ceiling. The fixture point in the ceiling should be (1,2,5), and the lamp is attached to a 2 unit long cord. One way to achieve this would be:

    frameWorld = TransformState.makePosHpr(Point3(1, 2, 5), Vec3(0, 0, 90))
    bodyB = ...
    frameB = TransformState.makePosHpr(Point3(-2, 0, 0), Vec3(0, 0, 0))

    cone = BulletConeTwistConstraint(bodyB, frameB)
    cone.setFrames(frameB, frameWorld)
    cone.setLimit(30, 30, 0, ...)

The world frame has an orientation because the default constraint axis in Bullet is the x-axis, and I want the cone openging to open in direction of -Z ("…hanging down…") and not +X.


Ah wonderful, and thank you! :slight_smile:

I take it that I should download the buildbot version of Panda to get these changes, and that they’ll be in 1.8.2?


You are welcome. And yes, the next buildbot version (give it a day or two) should include these functions. About 1.8.2: well, it is up to rdb to decide which changes get included. But I don’t see a reason why these fixes/amends should not be included.


Unfortunately I can’t pick up your fixes since your commit included some changes that alter the ABI signature of existing methods, eg. you’ve changed CPT(TransformState) to TransformState* etc. (more on ABI compatibility issues.)

If you have a changeset that only adds non-inline and non-virtual methods and does not modify the signatures of existing methods, then that could be included without a problem. If you don’t want to make a whole new checkout just for the purpose, just “cvs up -r panda3d_1_8_branch” in the bullet directory, make your change, commit and use “cvs up -A” to go back to HEAD.

Just give me a heads up, though, when you put anything new on a release branch.


Ok. I didn’t know that we enforce ABI compatibility between minor releases. I will try to keep compatibility for future changes. Most things amended or fixed so far will have to wait for the next major release (1.9.0). And users wanting to get the latest features/fixes can use the dev-builds.

I changed the signatures in various methods because passing a CPT(TransformState) as parameter has been a violation of Panda3D coding rules (CPT/PT is passed if the object retains a reference; otherwise we should pass the raw pointer - AFAIK). Only C++ users would have to adapt their code. From Python there should be no difference (or does interrogate steal a reference if passing a CPT/PT as an argument?).


It’s true there’s no difference to Python users, but we’d like all of the 1.8.x versions to remain binary-compatible for C++ users too. :slight_smile:



Fair enough; once I get back to the project that uses this feature I’ll hopefully switch over to the buildbot version of Panda, and, presuming that I get everything set up properly, will give the new version a shot. :slight_smile:


I think it should still be possible for you to just add the new methods for 1.8.2; provided they are not virtual, in which case special rules apply (since that would alter the vtable); you can just add that separately on the 1.8 branch. If they rely on methods that have changed since, however, then that won’t be possible.

A different question; Bullet allows passing disableCollisionsBetweenLinkedBodies in the attachConstraint method. Is there any way to set this setting in Panda? I am unable to use collision filtering to achieve something similar because it does not offer enough flexibility (in particular, it only allows one type of bitmask to be set, whereas I would require both an into and a from mask.)


Sure. Might be possible to add some other feature added since 1.8.0 too, but it will be hard to identify and isolate them.

Hmmm… must have missed this flag. Or it got removed when making the various attach_xyz methods obsolete. Whatever, I think it would be useful to have this parameter. Do you need it on the release branch, or is head sufficient? On the release branch we need to add a new method, while on the head we just need to add a this parameter to attach_constraint.

Try setting the config variable “bullet_filter_algorithm” to FilterAlgorithm::FA_callback, implement your own callback (derive from CallbackObject), and set the callback via BulletWorld::set_filter_callback. The callback will be invoked with a BulletFilterCallbackData object as parameter. You can access both PandaNodes (and evalutate the from/into masks in whatever way you like), and then set the evaluation result via BulletFilterCallbackData::set_collide(bool).

Just keep in mind that there is no assertion on the order of the colliding objects, so you have to implement a symetic algortihm, e. g.: (nodeA.from & nodeB.into) || (nodeB.from & nodeA.into).

By the way: using custom callbacks is possible from Python too, via PythonCallbackObject.


Thanks. We’re already using 1.9 because of other things so trunk is fine.


Hi Rdb, did this fix make it into runtime 1.0.4? My code seems to behave differently when running through the interpreter and once packed into a p3d file.


If it did not make it into 1.8.1, regardless of which version of the runtime you have, you won’t be able to use it yet. I can pick it up for 1.8.2 if enn0x thinks that it’s in a state to be picked up.


This particular fix did not make it into Panda3D 1.8.1. But it is possible to fix this without breaking ABI compatibility, and I think we should do it.

The last days I have been locating changed between current HEAD and Panda3D_1_8 release branch, and for those changes which could be transferred to the Panda3D_1_8 release branch (without breaking the ABI compat. ) I applied the changes to the release branch too. Here is my current status:

Things I have ready to commit on the Panda3D_1_8 release branch:

  • Fixed missing export for class BulletRayHit (EXPCL_PANDABULLET)
  • Fixed missing export for class BulletSoftBodyNodeElement (EXPCL_PANDABULLET)
  • Fixed missing export for class BulletVehicleTuning (EXPCL_PANDABULLET)
  • Fixed missing deg_2_rad in character controller “transform_changed” method
  • fixed bug in BulletSphericalConstraint::set_pivot_b (pivot_a has been modified)
  • New methods for setting contraint frames
  • New methods for setting constraint parameters
  • New methods for BulletManifoldPoints
  • New methods in BulletRigidBodyNode (inv. mass/intertia, total force/torque)
  • New methods for adding soft body linear joints
  • New method Bulletworld::get_debug_node

Things I didn’t touch so far:

  • Fixed typo in BulletManifoldPoint::get_lift_time (should be get_life_time…)
  • Fixes related to the scene graph sync mechanism (substantially reworked in HEAD)
  • Fixes related to collision shape scaling
  • Fixes related to const-ness of parameters or return values (might make it impossible to update to Bullet 2.8.1)
  • Fixes related to support of local transform states for shapes
  • New methods specific to Bullet 2.8.1 (rolling friction etc.)
  • New classes/methods related to callback objects (e. g. BulletFilterCallbackData, BulletTickCallbackData)
  • New classes/methods related to linear/rotational constraint motors
  • New classes/methods related to soft body angular joints (plus new class BulletSoftBodyControl)
  • New classes/methods related to wheel raycast information
  • Deprecated methods BulletWorld::attach_xxx (in favour of BulletWorld::attach)

There are still things which can be transferred to the release branch, but I will need a bit of time to isolate them. Unfortunately some of the most important fixes can’t be done without chaning signatures, e. g. the re-design of the scene graph sync mechanism which gives huge performance improvements if many objects are sleeping).

@rdb: Is it possible to make a private member const without breaking ABI compat.? (I’m not changing the member order or the data type, which both would have influences on the memory layout)