Thanks for your answer! I realized also bullet itself does not have this method. Probably this is because in theory there could be two different joint axis (one for every body). However, I was able to solve my problem by just remembering the axis I fed into the joint constructor and using the transform state of the corresponding body to transform the axis into world coordinates. Anyhow, thanks for your help!
Good solution. The axis should stay the same over time in local coordinates, so this should work.
What should this method do? Return the very same node you provided yourself when calling world.setDebugNode(node)? I’m not sure if it is worth having such a method (even though it would be a trivial method). Try to convince me that there is a use case.
I think such a helper method could be useful in other cases too, and since it doesn’t cost noticable performance I have added it to CVS.
For example you can get the list of bodies which have been modified (transform) since the last time you checked this way:
bodies = [x for x in world.getRigidBodies() if x.pickDirtyFlag()]
Of course it is faster not to create this list anew each frame, but store it somewhere.
Great! Thank you for your help, enn0x!
I’m looking to implement a 2d bridge using bullet. I would like to put forces on a bunch of nodes hinge constrained like the picture above. If the force is too great, more than 6lbf, I want the truss to fail and the nodes to disconnect (red truss).
I don’t see anything in the documentation to find the tension force between two nodes. How can I find this value? Also, how do I keep the physics constrained to two axes?
I think this has been implemented in world of goo, but i can’t find anything for tension in the ODE engine either. Any guidance would be appreciated!
I’m playing around with some really high numbers (mass 8.4e+6 and torque 2.5e+7) and my angular velocity rises for a bit then drops back to 0. Am I correct in that these values are too large for Bullet to handle?
It seems that the method I need is getjointfeedback, which returns the forces applied on the node. However, this method is not available in the API. The bullet homepage says getjointfeedback was added in the most recent bullet update 2.81, but it doesn’t seem to be available in the cvs.
Edit:the equivalent command is getfeedback for ODE.
No, I don’t think so. You probably see some other effect (friction, angular damping, angular factor, sleeping, …)
Right, reading the force and torque applied to each of the two bodies is added only with version 2.81 of Bullet. We still use the version 2.80, so we can’t expose this information.
But you can get an estimate of the applied impulse using constraint.getAppliedImpulse(), which should be perfectly fine for your purpose.
Note: Bullet does support breaking of constraints (by setting a threshold for the maximum applied impulse). But back then when writing the bindings for Panda3D I didn’t find out who Bullet reports back the fact that a joint is broken, and since I didn’t want to have zombie objects I did not expose the whole breaking feature.
Well, constraints which break won’t get remove from the world, they just get “disabled”. I added the following methods to support breakable constraints, but they are not tested so far:
- BulletConstraint.setBreakingThreshold() --> float
- BulletConstraint.isEnabled() --> bool
Thanks a lot! I’ll test it out. Thanks. I guess this is the breakingimpulsethreshold() from c++.
EDIT: Seems to work so far! Thanks again. A sample.http://sites.google.com/site/ambyra/all/10_HingeConstraint.py
Ended up it was a sleeping threshold issue. Thank you sir for your help!
Using a Ghost node, calling getOverlappingNodes appears to be returning objects that have overlapping bounding boxes, not necessarily overlapping shapes.
For example, I create a Ghost with a sphere shape. When a rigid body approaches from what would be the axis-aligned bounding box corner for that sphere, it will be returned by getOverlappingNodes.
Is this the intended behaviour? Am I supposed to do additional checks to see which nodes are actually touching my Ghost?
UPDATE: Should have searched better first, I see that this is indeed the case.
You are right. This is Bullet terminology: “overlap” means overlapping bounding boxes, not only for ghosts, but for all collision objects. I’m not happy with this choice of words, and it has cause quite some confusion so far. Sorry.
Hiya I am new to Panda so let me start by thanking everyone involved for this great body of work.
I have a question on the Bullet implementation. For the Generic constraint, there appears to be angular motor functions in the Bullet.org documentation, but no access in Panda (it is not mentioned in the API and fails when i try to call them on a generic constraint). Seems rather nifty as it allows you to specify motors for each axis and if I understood correctly they are supposed to be a lot more stable than the coneTwist constraint with motors.
Is it possible to call or expose those functions from Panda?
The angular motors are (so far) not expose, and thus not callable. The reason why I omitted them is simply that I have not been able to clearly understand how they are supposed to work from looking at the Bullet API. And digging through the Bullet source code is tedious.
I want to be able to serialise my scene to xml. If I set a world’s debug node I can’t retrieve it later when it comes to saving the scene. When the appropriate “get” method is missing from NodePaths I just set the value as a python tag, but BulletWorld isn’t a NodePath so I can’t use that workaround.
If there’s another way to attach arbitrary data to a BulletWorld node that would be good enough.
Ok, I added BulletWord.getDebugNode() yesterday. The next buildbot buils should pick it up.
Thanks enn0x! That’s a big help. Just wondering, is there any way to display the debug without having the world physics enabled? I suppose I could run physics with no gravity but I was wondering if there was another way.