protected void setMode(Mode mode) {
        this.mode = mode;
        AnimControl animControl = targetModel.getControl(AnimControl.class);
        animControl.setEnabled(mode == Mode.Kinematic);

        baseRigidBody.setKinematic(mode == Mode.Kinematic);
        if (mode != Mode.IK) {
            TempVars vars = TempVars.get();

            for (PhysicsBoneLink link : boneLinks.values()) {
                link.rigidBody.setKinematic(mode == Mode.Kinematic);
                if (mode == Mode.Ragdoll) {
                    Quaternion tmpRot1 = vars.quat1;
                    Vector3f position = vars.vect1;
                    //making sure that the ragdoll is at the correct place.
                    matchPhysicObjectToBone(link, position, tmpRot1);
                }

            }
            vars.release();
        }

        if(mode != Mode.IK){
            for (Bone bone : skeleton.getRoots()) {
                RagdollUtils.setUserControl(bone, mode == Mode.Ragdoll);
            }
        }
        
    }
Enable or disable the ragdoll behaviour. if ragdollEnabled is true, the
character motion will only be powered by physics else, the character will
be animated by the keyframe animation, but will be able to physically
interact with its physics environment

@param mode an enum value (not null)
jme3-jbullet/src/main/java/com/jme3/bullet/control/KinematicRagdollControl.java