From a330f83a2d6d8fad9f975ac81b052ebe0ba4f7ee Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sat, 22 Dec 2012 15:02:40 +0000 Subject: [PATCH] fixed issue 418 http://code.google.com/p/jmonkeyengine/issues/detail?id=418&q=label%3AProduct-jME3&sort=priority&colspec=ID%20Type%20Status%20Component%20Priority%20Difficulty%20Product%20Milestone%20Owner%20Summary git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10039 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/cinematic/events/MotionEvent.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/engine/src/core/com/jme3/cinematic/events/MotionEvent.java b/engine/src/core/com/jme3/cinematic/events/MotionEvent.java index 473129657..2e5c8987d 100644 --- a/engine/src/core/com/jme3/cinematic/events/MotionEvent.java +++ b/engine/src/core/com/jme3/cinematic/events/MotionEvent.java @@ -234,7 +234,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control { switch (directionType) { case Path: Quaternion q = new Quaternion(); - q.lookAt(direction, Vector3f.UNIT_Y); + q.lookAt(direction, upVector); spatial.setLocalRotation(q); break; case LookAt: @@ -245,7 +245,7 @@ public class MotionEvent extends AbstractCinematicEvent implements Control { case PathAndRotation: if (rotation != null) { Quaternion q2 = new Quaternion(); - q2.lookAt(direction, Vector3f.UNIT_Y); + q2.lookAt(direction, upVector); q2.multLocal(rotation); spatial.setLocalRotation(q2); } @@ -339,12 +339,25 @@ public class MotionEvent extends AbstractCinematicEvent implements Control { } /** - * Sets the direction of the spatial + * Sets the direction of the spatial, using the Y axis as the up vector + * Use MotionEvent#setDirection((Vector3f direction,Vector3f upVector) if + * you want a custum up vector. * This method is used by the motion path. * @param direction */ public void setDirection(Vector3f direction) { + setDirection(direction, Vector3f.UNIT_Y); + } + + /** + * Sets the direction of the spatial witht ht egiven up vector + * This method is used by the motion path. + * @param direction + * @param upVector the up vector to consider for this direction + */ + public void setDirection(Vector3f direction,Vector3f upVector) { this.direction.set(direction); + this.upVector.set(upVector); } /**