diff --git a/WesLibrary/src/main/java/com/jme3/scene/plugins/bvh/SkeletonMapping.java b/WesLibrary/src/main/java/com/jme3/scene/plugins/bvh/SkeletonMapping.java index d9a614b..ad957a4 100644 --- a/WesLibrary/src/main/java/com/jme3/scene/plugins/bvh/SkeletonMapping.java +++ b/WesLibrary/src/main/java/com/jme3/scene/plugins/bvh/SkeletonMapping.java @@ -149,7 +149,7 @@ public BoneMapping getForSource(String sourceBoneName) { public SkeletonMapping inverse() { SkeletonMapping result = new SkeletonMapping(); for (BoneMapping boneMapping : mappings.values()) { - Quaternion twist = boneMapping.getTwist(); + Quaternion twist = boneMapping.getTwist(); // alias Quaternion inverseTwist = twist.inverse(); String targetName = boneMapping.getTargetName(); String sourceName = boneMapping.getSourceName(); @@ -300,7 +300,7 @@ public SkeletonMapping clone() throws CloneNotSupportedException { super.clone(); SkeletonMapping result = new SkeletonMapping(); for (BoneMapping boneMapping : mappings.values()) { - Quaternion twist = boneMapping.getTwist(); + Quaternion twist = boneMapping.getTwist(); // alias twist = twist.clone(); String targetName = boneMapping.getTargetName(); String sourceName = boneMapping.getSourceName(); diff --git a/WesLibrary/src/main/java/jme3utilities/wes/Pose.java b/WesLibrary/src/main/java/jme3utilities/wes/Pose.java index e6f4545..386b33d 100644 --- a/WesLibrary/src/main/java/jme3utilities/wes/Pose.java +++ b/WesLibrary/src/main/java/jme3utilities/wes/Pose.java @@ -1114,19 +1114,20 @@ private void retargetBones( assert map != null; int targetIndex = skeleton.getBoneIndex(bone); - Transform userTransform = transforms.get(targetIndex); + Transform userTransform = transforms.get(targetIndex); // alias userTransform.loadIdentity(); String targetName = bone.getName(); - BoneMapping boneMapping = map.get(targetName); + BoneMapping boneMapping = map.get(targetName); // alias if (boneMapping != null) { // Calculate the orientation of the source bone in model space. String sourceName = boneMapping.getSourceName(); int sourceIndex = sourcePose.findBone(sourceName); Quaternion mo = sourcePose.modelOrientation(sourceIndex, null); + // Set the orientation of the target bone in user space: Quaternion userRotation = userForModel(targetIndex, mo, null); - Quaternion twist = boneMapping.getTwist(); + Quaternion twist = boneMapping.getTwist(); // alias Quaternion rot = userTransform.getRotation(); // alias userRotation.mult(twist, rot); MyQuaternion.normalizeLocal(rot); @@ -1153,20 +1154,21 @@ private void retargetJoints( assert map != null; int targetIndex = joint.getId(); - Transform userTransform = transforms.get(targetIndex); + Transform userTransform = transforms.get(targetIndex); // alias userTransform.loadIdentity(); String targetName = joint.getName(); - BoneMapping boneMapping = map.get(targetName); + BoneMapping boneMapping = map.get(targetName); // alias if (boneMapping != null) { // Calculate the orientation of the source joint in model space. String sourceName = boneMapping.getSourceName(); int sourceIndex = sourcePose.findBone(sourceName); Quaternion mo = sourcePose.modelOrientation(sourceIndex, null); + // Set the orientation of the target joint in user space: Quaternion userRotation = userForModel(targetIndex, mo, null); - Quaternion twist = boneMapping.getTwist(); - Quaternion rot = userTransform.getRotation(); + Quaternion twist = boneMapping.getTwist(); // alias + Quaternion rot = userTransform.getRotation(); // alias userRotation.mult(twist, rot); MyQuaternion.normalizeLocal(rot); }