Problem while migrating from old JME code

I migrated an application from older svn code (revision 6207 in the jme3 branch) to the current revision.

Some months ago, there has been a change how physics are handled. I could migrate nearly all code (also noticed the fact, that the physicslocation of RigidBodyControls must be updated when a node is moved), but one problem remains:

I have several objects lying on a plane, when new objects appear and collide with other, they slide softly over the plane (like on a billard table).

For that, I extended PhysicsNode and set the following values in the constructor:



setDamping(.5f, .5f);


setSleepingThresholds(3f, 3f);


In my new code, I change the node to com.jme3.scene.Node and added a RigidBodyControl to it:


control = new RigidBodyControl(new BoxCollisionShape(new Vector3f(.1f, .1f,




control.setDamping(.5f, .5f);


control.setSleepingThresholds(3f, 3f);


The objects are no longer sliding softly over the plane, they jump and shiver all the time. I tried different values but could not create the old effect.

Have the values new bounds oder have been scaled in the last months?

No they haven’t. You should best set the mass in the constructor in any case, otherwise the mass distribution has to be recalculated. How do you add the objects?

I used to create the RigidBodeControl with a boxcollisionshape and set the real collision shape later. Now I set the mass and the collision shape in the constructor and everything works fine.

Seems like the order how parameters are set is important. Re-setting the collision shape seems to override the parameters (damping, friction, sleeping thresholds, restitution). Changing these parameters before the control has been added to a node causes an exception.

Maybe you should take a look into this, to make it more user-friendly. If the code order is mandatory, it should be mentioned in the documentation.

Thanks for your quick help.

Well the mass is always correlated to the collision shape and it always was. Idk why the parameters should be overridden, the RigidBody holding this data is kept. If that is so then it always was this way when adding a new collision shape cause I dont do anything about this…

Yes, you’re right. The mass depends on the collision shape. But I did not know that. I found no documentation about this point.

I think this is formally incosistent.

The mass is correlated to the collision shape. Ok, accepted. Look at the code:

[java] RigidBodyControl control = new RigidBodyControl();

System.out.println("Mass: " + control.getMass());

System.out.println("Linear Damp: " + control.getLinearDamping());

System.out.println("Angular Damp: " + control.getAngularDamping());[/java]

The control has no collision shape, so it should have no mass. No, the output says: “Mass: 1.0”. On line 3, the code throws a NullpointerException.

So I can not access the other parameters when no collision shape is set.

I have no chance to set the physics parameters during node creation and attach the object and its collision shape later. :frowning:

life’s a bitch but you didnt do that earlier either.

Thanks for solving the initial problem 8)