I’m trying to get a BulletSliderConstraint to work since a few hours. There’s no python example code on the web I could find and the Panda development api reference is naturally not populated yet.
What I have:
This should result in two boxes, about 1 unit above each other, where the lower one should fall down and then hang beneath the first one. What happens is this:
:bullet(error): setWorldTransform: trans is NAN!
(about 20 times)
:bullet(error): setWorldTransform: trans is NAN!
:bullet(error): Overflow in AABB, object removed from simulation
:bullet(error): If you can reproduce this, please email bugs@continuousphysics.com
:bullet(error): Please include above information, your Platform, version of OS.
:bullet(error): Thanks.
As I guess this is rather a bug (if at all) in Panda’s wrapper than Bullet: What might be wrong here? And how does one use sliders (especially these StateTransforms) correctly?
The answer to this is fairly simple: hinge and slider don’t work on linux yet. I’ve asked about them over on the bullet thread: panda3d.org/forums/viewtopic … &start=300
Thank you for the effort invested, but I dare say that you won’t get a solution this way. For Bullet users it would be way too complicated to read into the Panda3D code (the would need to understand how PandaNodes work internally!). The most promising thing would be to write a small C++ sample wich reproduces the problem - if there is a problem on the Bullet side at all.
We don’t have different implementation for Windows or Linux (or OSX). The implementation is the same for every OS. It’s just that this code leads to a crash on one OS, and works fine on the other.
I would recommend writing a small C++ console application, which links only with Bullet (no Panda3D stuff). Set up two bodies and a slider like in the sample above, and see print out the transforms of the two bodies for, say, 60 timesteps each 1/60 seconds.
Edit: I’ve tried adding np*.setHpr(0, 0, 0) to both boxes in your example, but that doesn’t change things. Additionally, you indeed initialize the TransformStates with makePosHpr…
Nope. The AABB overflow is the same, no matter if using the C++ API of Panda3D or if using the Python API. Wild guessing doesn’t get us further. I’m working on this issue, but I just have a limited amount of spare time to spend on this hobby, so please be patient.
I finally located the problem and checked in a fix. Please test the next (after today) snapshot build on Linux.
The problem has been that Panda3D Bullet module initially creates rigid bodies with identity transform (when creating a new instance of BulletRigidBodyNode). Changes to the node’s transform (e.g. using np.setPos) are handed on to the wrapped btRigidBody, but Bullet didn’t update the inertia tensor by default. Now I use another method which also updates the inertia tensor.
The constraint seems to work now! (Read: the boxes somehow flick around on startup and no AABB overflow occurs.)
Still, I cannot thoroughly figure out what information the TransformStates convey and how they need to be set up. For example the BulletSliderConstraint: Somewhere I’ve read that each TState specifies to what extent each side of the constraint should be able to move into various directions. But how exactly does that work?