Skip to content

Commit

Permalink
TransformTrackBuilder: normalize the rotations passed to addRotation()
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Sep 28, 2023
1 parent 587db81 commit 7c65387
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import java.util.logging.Logger;
import jme3utilities.Validate;
import jme3utilities.math.MyArray;
import jme3utilities.math.MyQuaternion;

/**
* Gather the data needed to construct a JMonkeyEngine TransformTrack.
Expand Down Expand Up @@ -64,7 +63,7 @@ public class TransformTrackBuilder {
*/
final private HasLocalTransform target;
/**
* maps animation times to rotation vectors
* maps animation times to (normalized) rotation vectors
*/
final private Map<Float, Quaternion> rotationMap = new TreeMap<>();
/**
Expand Down Expand Up @@ -120,9 +119,8 @@ public TransformTrackBuilder(HasLocalTransform target, float duration) {
*/
public void addRotation(float time, Quaternion rotation) {
Validate.inRange(time, "time", 0f, duration);
MyQuaternion.validateUnit(rotation, "rotation", 0.0005f);

Quaternion cloneRotation = rotation.clone();
Quaternion cloneRotation = rotation.clone().normalizeLocal();
rotationMap.put(time, cloneRotation);
timeSet.add(time);
}
Expand Down

0 comments on commit 7c65387

Please sign in to comment.