* Fixed issue where scene graphs with non-uniform scales would give incorrect result

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7291 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent bfe772dd71
commit a06ce4ebcd
  1. 4
      engine/src/core/com/jme3/animation/Bone.java
  2. 16
      engine/src/core/com/jme3/math/Transform.java

@ -237,7 +237,6 @@ public final class Bone implements Savable {
*/
public final void updateWorldVectors() {
if (parent != null) {
//rotation
parent.worldRot.mult(localRot, worldRot);
@ -251,9 +250,6 @@ public final class Bone implements Savable {
parent.worldRot.mult(localPos, worldPos);
worldPos.multLocal(parent.worldScale);
worldPos.addLocal(parent.worldPos);
} else {
worldRot.set(localRot);
worldPos.set(localPos);

@ -200,11 +200,18 @@ public final class Transform implements Savable, Cloneable {
scale.multLocal(parent.scale);
// rot.multLocal(parent.rot);
parent.rot.mult(rot, rot);
// This here, is evil code
// parent
// .rot
// .multLocal(translation)
// .multLocal(parent.scale)
// .addLocal(parent.translation);
translation.multLocal(parent.scale);
parent
.rot
.multLocal(translation)
.multLocal(parent.scale)
.addLocal(parent.translation);
return this;
}
@ -262,8 +269,9 @@ public final class Transform implements Savable, Cloneable {
@Override
public String toString(){
return getClass().getSimpleName() + "[ "+translation.x + ", "+ translation.y + ", "+translation.z+"]\n"+
"[ "+rot.x + ", " + rot.y + ", " + rot.z + ", " + rot.w + "]";
return getClass().getSimpleName() + "[ " + translation.x + ", " + translation.y + ", " + translation.z + "]\n"
+ "[ " + rot.x + ", " + rot.y + ", " + rot.z + ", " + rot.w + "]\n"
+ "[ " + scale.x + " , " + scale.y + ", " + scale.z + "]";
}
/**

Loading…
Cancel
Save