Fixed MotionTrack setEnabled method
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8954 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
9232c71cd7
commit
1b1bad7da5
@ -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
|
||||||
*/
|
*/
|
||||||
@ -194,7 +192,7 @@ public class MotionTrack extends AbstractCinematicEvent implements Control {
|
|||||||
//getting waypoint index and current value from new traveled distance
|
//getting waypoint index and current value from new traveled distance
|
||||||
Vector2f v = path.getWayPointIndexForDistance(traveledDistance);
|
Vector2f v = path.getWayPointIndexForDistance(traveledDistance);
|
||||||
//setting values
|
//setting values
|
||||||
currentWayPoint = (int)v.x;
|
currentWayPoint = (int) v.x;
|
||||||
setCurrentValue(v.y);
|
setCurrentValue(v.y);
|
||||||
//interpolating new position
|
//interpolating new position
|
||||||
path.getSpline().interpolate(getCurrentValue(), getCurrentWayPoint(), temp);
|
path.getSpline().interpolate(getCurrentValue(), getCurrentWayPoint(), temp);
|
||||||
@ -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) {
|
||||||
play();
|
if (enabled) {
|
||||||
|
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…
x
Reference in New Issue
Block a user