Problem with "ragdoll.setControl(true);"


I am modifying “” to load my own simple model (a rectangular cube with just 2 bones). The program works OK at first when the statement “ragdoll.setControl(true);” is located inside the “collide(Bone bone, PhysicsCollisionObject object,PhysicsCollisionEvent event)” event handler. The simple cube begins to be controlled by the RagdollControl when a canon ball collides with that cube.

However, when I add another “ragdoll.setControl(true);” at the end of the “simpleInitApp()” method, the ragdoll seems to disappear when the scene starts and I could not see my cube.

I add “ragdoll.setControl(true);” at the end of the “simpleInitApp()” method so as to make the RagdollControl in effect when the program begins.

Is there any restriction in using “ragdoll.setControl(true);”. Is there any prerequisite that should be done before calling “ragdoll.setControl(true);” ?


One more addition, I am using jMonkeyEngine3 nightly build 2011-04-26. It seems that the latest build has some changes in the “RagdollControl” class.


yes, update to last SVN please

Ragdoll is still a WIP and initialization phase needs to be done in a specific order, I’ll change that, but it’s like that for now.

Use the last svn, and retest.

SetControl(true) disappeared, and to activate the ragdoll you now have to use setRagdollMode().

I tested it on TestBoneRagdoll and if you activate it at the end of the simpleInit, it works fine.

8)Hi nehon,

It now works when “ragdoll.setRagdollMode();” is placed at the end of “simpleInitApp()”. Thanks.

In the previous version of “”, there is a “if (!ragdoll.hasControl())” statement, but now this method no longer exists. Is there any method in the new version that corresponds to the “hasControl()” method ?

I need this method as sometimes I want to know whether the model is in “Ragdoll” control mode.


yes, you can check the mode by doing this ragdoll.getMode()==KinematicRagdollControl.Mode.Ragdoll

  1. Thanks nehon . My simple model now works.<br />

One more question, my simple model is in fact a very simple robot hand with just one lower arm and one upper arm. I am using "KinematicRagdollControl" for my simple model (so that it follows Physics constraints), but I want the lower arm to be fixed on the floor while the upper arm is free to move. I am planning to use a fixed "SixDofJoint" to join the floor to the lower arm. However, I don't know how to extract the "Node" (and hence the "RigidBodyControl") of the lower arm to form that fixed joint. Moreover, as the upper arm moves/rotates, the lower arm may have some deformation. (the mesh of the lower arm node may have small changes when the upper arm moves/rotates), so I am wondering whether it is a good idea to form a fixed joint between the lower arm node and the floor.

As I think the lower arm bone is fix (and would not deform) while the upper arm moves, I want to know that could I define a fixed "SixDofJoint" from the bone of the lower arm to the floor ? If yes, how to extract the "RigidBodyControl" of that bone so as to form the fixed "SixDofJoint" ? If no, then how to extract the "RigidBodyControl" of the lower arm node to form the fixed ""SixDofJoint" ?

Perhaps there may be other simpler solutions that I have not thought of.

Thanks for any suggestion.


Maybe you should set the mass of the first rigidbody to 0

So it wouldn’t be mobile in physic space.

I thought to add support to tweak the mass bone by bone, I guess it’s time to do it :wink:

8)Hi nehon,

It seems that I could only change the “weightThreshold” (while I don’t know its meaning !) in the constructor of “KinematicRagdollControl” but I could not assign the masses of the “PhysicsRigidBody” of the parts of the ragdoll. The “rootMass” in "KinematicRagdollControl” is hardcoded to be 15 and could not be changed.

It’s great if you could tweak “KinematicRagdollControl” so that I could assign a zero mass to the “PhysicsRigidBody” of the lower arm node while I could assign a non-zero mass to the upper arm node.

Wait for the improvement. Thanks.


There can never be movable zero-mass objects.

8)Oh ! nehon. Perhaps I let you mis-understand.

I want the “PhysicsRigidBody” of the lower arm node to have zero mass as I want it to be fixed. I only want the upper arm to move/rotate based on the fixed lower arm. So it would be best if I could assign different masses to the “PhysicsRigidBody” of the lower arm and the upper arm.

I am not using the “KinematicRagdollControl” class in its usual way.


yep, I understand.

In last SVN you can use getBoneRigidBody(String boneName) that will return the RigidBody associated with this bone.

So you can then use setMass on it.

I tested it on Sinbad and set his left foot to be of mass 0, and the result is hilarious :smiley:

8)Yeah, nehon, glad to have your fast update after a sleep.

However, it seems that the update to “KinematicRagdollControl” is not yet contained in the last svn and nightly_build_2011-05-16.

Hope the update to be consolidated since nightly_build_2011-05-17 (as I am not familiar with using the svn source).


:DHi nehon,

It now works perfectly in nightly build 2011-05-17. Thanks a lot for your graceful support.


You’re welcome