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. 12
      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 MotionPath path;
private boolean isControl = true;
/**
* the distance traveled by the spatial on the path
*/
protected float traveledDistance = 0;
/**
* Enum for the different type of target direction behavior
*/
@ -194,7 +192,7 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
//getting waypoint index and current value from new traveled distance
Vector2f v = path.getWayPointIndexForDistance(traveledDistance);
//setting values
currentWayPoint = (int)v.x;
currentWayPoint = (int) v.x;
setCurrentValue(v.y);
//interpolating new position
path.getSpline().interpolate(getCurrentValue(), getCurrentWayPoint(), temp);
@ -203,8 +201,6 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
vars.release();
}
public void onUpdate(float tpf) {
traveledDistance = path.interpolatePath(time, this);
computeTargetDirection();
@ -434,7 +430,11 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
}
public void setEnabled(boolean enabled) {
if (enabled) {
play();
} else {
pause();
}
}
public boolean isEnabled() {
@ -459,6 +459,4 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
public float getTraveledDistance() {
return traveledDistance;
}
}

Loading…
Cancel
Save