@Override
    protected void createSpatialData(Spatial model) {
        targetModel = model;
        Node parent = model.getParent();


        Vector3f initPosition = model.getLocalTranslation().clone();
        Quaternion initRotation = model.getLocalRotation().clone();
        initScale = model.getLocalScale().clone();

        model.removeFromParent();
        model.setLocalTranslation(Vector3f.ZERO);
        model.setLocalRotation(Quaternion.IDENTITY);
        model.setLocalScale(1);
        //HACK ALERT change this
        // I remove the SkeletonControl and re-add it to the Spatial to make sure it's after the ragdoll control in the stack.
        //Find a proper way to order the controls.
        SkeletonControl sc = model.getControl(SkeletonControl.class);
        if(sc == null){
            throw new IllegalArgumentException("The root node of the model should have a SkeletonControl. Make sure the control is there and that it's not on a sub node.");
        }
        model.removeControl(sc);
        model.addControl(sc);

        if (boneList.isEmpty()) {
            // add all bones to the list
            skeleton = sc.getSkeleton();
            for (int boneI = 0; boneI < skeleton.getBoneCount(); boneI++) {
                String boneName = skeleton.getBone(boneI).getName();
                boneList.add(boneName);
            }
        }
        // filter out bones without vertices
        filterBoneList(sc);

        if (boneList.isEmpty()) {
            throw new IllegalArgumentException(
                    "No suitable bones were found in the model's skeleton.");
        }

        // put into bind pose and compute bone transforms in model space
        // maybe don't reset to ragdoll out of animations?
        scanSpatial(model);


        if (parent != null) {
            parent.attachChild(model);

        }
        model.setLocalTranslation(initPosition);
        model.setLocalRotation(initRotation);
        model.setLocalScale(initScale);

        if (added) {
            addPhysics(space);
        }
        logger.log(Level.FINE, "Created physics ragdoll for skeleton {0}", skeleton);
    }
Create spatial-dependent data. Invoked when this control is added to a
scene.

@param model the controlled spatial (not null)
jme3-jbullet/src/main/java/com/jme3/bullet/control/KinematicRagdollControl.java