Fixed MotionTrack setEnabled method

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8954 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 9232c71cd7
commit 1b1bad7da5
  1. 10
      engine/src/core/com/jme3/cinematic/events/MotionTrack.java

@ -69,13 +69,11 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
protected Direction directionType = Direction.None; protected Direction directionType = Direction.None;
protected MotionPath path; protected MotionPath path;
private boolean isControl = true; private boolean isControl = true;
/** /**
* the distance traveled by the spatial on the path * the distance traveled by the spatial on the path
*/ */
protected float traveledDistance = 0; protected float traveledDistance = 0;
/** /**
* Enum for the different type of target direction behavior * Enum for the different type of target direction behavior
*/ */
@ -203,8 +201,6 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
vars.release(); vars.release();
} }
public void onUpdate(float tpf) { public void onUpdate(float tpf) {
traveledDistance = path.interpolatePath(time, this); traveledDistance = path.interpolatePath(time, this);
computeTargetDirection(); computeTargetDirection();
@ -434,7 +430,11 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
if (enabled) {
play(); play();
} else {
pause();
}
} }
public boolean isEnabled() { public boolean isEnabled() {
@ -459,6 +459,4 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
public float getTraveledDistance() { public float getTraveledDistance() {
return traveledDistance; return traveledDistance;
} }
} }

Loading…
Cancel
Save