From 696c790585b5c979fdd682965189698327c8fc68 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Wed, 16 Nov 2005 02:28:25 +0000 Subject: [PATCH] Something is wacky with PathUtil.computeRotation, but I can't figure out what. Having tried various tweaks with no success, I finally punted and changed LineSegmentPath to use computeAxisRotation. I also fixed the order of cross products in that method and got rid of a redundant cross product. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3761 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/jme/sprite/LineSegmentPath.java | 7 +++++-- src/java/com/threerings/jme/sprite/PathUtil.java | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/jme/sprite/LineSegmentPath.java b/src/java/com/threerings/jme/sprite/LineSegmentPath.java index d37812cfd..bec58a7af 100644 --- a/src/java/com/threerings/jme/sprite/LineSegmentPath.java +++ b/src/java/com/threerings/jme/sprite/LineSegmentPath.java @@ -48,6 +48,7 @@ public class LineSegmentPath extends Path _orient = orient; _points = points; _durations = durations; + PathUtil.computeRotation(up, orient, Vector3f.UNIT_X, _prerot); updateRotation(); } @@ -89,7 +90,8 @@ public class LineSegmentPath extends Path protected void updateRotation () { _points[_current+1].subtract(_points[_current], _temp); - PathUtil.computeRotation(_up, _orient, _temp, _rotate); + PathUtil.computeAxisRotation(_up, _temp, _rotate); + _rotate.multLocal(_prerot); _sprite.getLocalRotation().set(_rotate); } @@ -99,5 +101,6 @@ public class LineSegmentPath extends Path protected float _accum; protected int _current; protected Vector3f _temp = new Vector3f(0, 0, 0); - protected Quaternion _rotate = new Quaternion(); + protected Quaternion _prerot = new Quaternion(), + _rotate = new Quaternion(); } diff --git a/src/java/com/threerings/jme/sprite/PathUtil.java b/src/java/com/threerings/jme/sprite/PathUtil.java index 20f3b24b8..7512377d9 100644 --- a/src/java/com/threerings/jme/sprite/PathUtil.java +++ b/src/java/com/threerings/jme/sprite/PathUtil.java @@ -44,10 +44,9 @@ public class PathUtil { _axes[0].set(orient); _axes[0].normalizeLocal(); - _axes[0].cross(up, _axes[1]); + up.cross(_axes[0], _axes[1]); _axes[1].normalizeLocal(); - _axes[1].cross(_axes[0], _axes[2]); - _axes[2].cross(_axes[0], _axes[1]); + _axes[0].cross(_axes[1], _axes[2]); target.fromAxes(_axes); return target; }