-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
physics joints don't work unless both bodies are dynamic #877
Comments
The solution was: Use jme3-jbullet library. Not the jme3-bullet and jme3-bullet-native library. jme3-bullet and jme3-bullet-native is default in the library folder at SDK 3.2 version. |
I'm investigating this one, but don't have much of a handle on it yet. |
Well, I've made some progress.
I'm not sure why the native Bullet version was changed between JME 3.1 and JME 3.2 but it might be a good idea to revert it. |
The Bullet version was changed via pull request #698. |
Also changed by pull request #528. |
I would suggest the opposite, see if a even newer version fixes the issue as well, if we go that path |
I've tested this with a newer build of bullet (from their master branch) and nothing changed. @@ -107,7 +107,15 @@
float size = 0.1f;
Vector3f halfExtents = new Vector3f(size, size, size);
CollisionShape shape = new BoxCollisionShape(halfExtents);
- RigidBodyControl control = new RigidBodyControl(shape, mass);
+ RigidBodyControl control;
+ if(mass==0){
+ mass=1000;
+ control=new RigidBodyControl(shape,mass);
+ control.setAngularDamping(1);
+ control.setLinearDamping(1);
+ }else{
+ control= new RigidBodyControl(shape, mass);
+ }
Node node = new Node();
node.addControl(control);
rootNode.attachChild(node);
EDIT: @@ -107,8 +107,16 @@
float size = 0.1f;
Vector3f halfExtents = new Vector3f(size, size, size);
CollisionShape shape = new BoxCollisionShape(halfExtents);
- RigidBodyControl control = new RigidBodyControl(shape, mass);
Node node = new Node();
+ RigidBodyControl control;
+ if(mass==0){
+ mass=1;
+ control = new RigidBodyControl(shape,mass);
+ control.setKinematic(true);
+ node.setLocalTranslation(location);
+ }else{
+ control= new RigidBodyControl(shape, mass);
+ }
node.addControl(control);
rootNode.attachChild(node);
bulletAppState.getPhysicsSpace().add(node); |
So... I haven't found any documentation that says if attaching a costraint to a static body is something supposed to work or not, but I've figured we could use the constructor that asks only for one rigidbody and use a fixed point+pivot for the static body. This is what i've come up with riccardobl@8c4d96c I have 3 main concerns with it:
Neverless, this seems to work fine in my scene and in your test. |
3 is a non issue, as moving a static rb is not supported by bullet anyway and will make it explode when using non trivial math shapes. (eg box often works, but a meshshape will not at all) |
According to the Bullet Manual:
However, the kernel of this issue seems to be that Bullet constraints don't work well unless ALL bodies connected to the constraint are dynamic. The number of constraints isn't the issue. While I appreciate the ingenuity of riccardobl's proposed fix, a better solution, I think, would be to document this limitation and expose single-ended constraints in It's also conceivable that the issue has been fixed in Bullet. I'll explore this possibility. |
I'm seeing evidence that simply upgrading to Bullet v2.87 will resolve the issue. I'll generate a pull request. |
The upgrade resolved the issue. The hard part was getting Travis and AppVeyor to build new native libraries. Fixed in |
The issue is now resolved for native Bullet ( |
Lacking source code, I have no clue how to fix JBullet. |
Hi!
I was following this tutorial https://wiki.jmonkeyengine.org/jme3/advanced/hinges_and_joints.html and I'm doing a cradle with 6 joints and 6 balls.
The problem is that if I have more than 1 joint, the other joints is going to fall down.
Here is the code. Try to run it and add some hinge joints by removing the comments down there.
Right now the code
bulletAppState.getPhysicsSpace().add(Wire1Joint1);
Is activaded and you should see a pendelum with a square.
Try to activate
bulletAppState.getPhysicsSpace().add(Wire1Joint2);
Information
jMonkeyEngine V3.2.1-Stable SDK 3 with JDK 1.8 as default
The text was updated successfully, but these errors were encountered: