public static void setBonesSuchAs(AnimControl animControl, String animationName) { Animation animation = animControl.getAnim(animationName); int size = animControl.getSkeleton().getBoneCount(); for (int index = 0; index < size; index++) { Bone bone = animControl.getSkeleton().getBone(index); BoneTrack boneTrack = getFirstTrackForBone(animation, index); if (boneTrack != null) { Quaternion rotation = boneTrack.getRotations()[0]; Vector3f translation = boneTrack.getTranslations()[0]; Vector3f scale = boneTrack.getScales()[0]; System.out.println("Bone = " + bone.getName()); System.out.println("\tRotation = " + rotation); System.out.println("\tTranslation = " + translation); System.out.println("\tScale = " + scale); bone.setUserControl(true); bone.setUserTransforms(translation, rotation, scale); bone.updateWorldVectors(); bone.setUserControl(false); } } }
/** @return the array of scales for this track */ public Vector3f[] getScales() { if (boneTrack != null) { return boneTrack.getScales(); } return spatialTrack.getScales(); }