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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user