|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme3.cinematic.events.AbstractCinematicEvent
com.jme3.cinematic.events.MotionTrack
public class MotionTrack
A MotionTrack is a control over the spatial that manage the position and direction of the spatial while following a motion Path You must first create a MotionPath and then create a MotionTrack to associate a spatial and the path.
Nested Class Summary | |
---|---|
static class |
MotionTrack.Direction
Enum for the different type of target direction behavior |
Field Summary | |
---|---|
protected float |
currentValue
|
protected int |
currentWayPoint
|
protected Vector3f |
direction
|
protected MotionTrack.Direction |
directionType
|
protected Vector3f |
lookAt
|
protected MotionPath |
path
|
protected Quaternion |
rotation
|
protected Spatial |
spatial
|
protected float |
traveledDistance
the distance traveled by the spatial on the path |
protected Vector3f |
upVector
|
Fields inherited from class com.jme3.cinematic.events.AbstractCinematicEvent |
---|
initialDuration, listeners, loopMode, playState, resuming, speed, time |
Constructor Summary | |
---|---|
MotionTrack()
Create MotionTrack, when using this constructor don't forget to assign spatial and path |
|
MotionTrack(Spatial spatial,
MotionPath path)
Creates a MotionPath for the given spatial on the given motion path |
|
MotionTrack(Spatial spatial,
MotionPath path,
float initialDuration)
Creates a MotionPath for the given spatial on the given motion path |
|
MotionTrack(Spatial spatial,
MotionPath path,
float initialDuration,
LoopMode loopMode)
Creates a MotionPath for the given spatial on the given motion path |
|
MotionTrack(Spatial spatial,
MotionPath path,
LoopMode loopMode)
Creates a MotionPath for the given spatial on the given motion path |
Method Summary | |
---|---|
Control |
cloneForSpatial(Spatial spatial)
Clone this control for the given spatial |
float |
getCurrentValue()
this method is meant to be called by the motion path only |
int |
getCurrentWayPoint()
this method is meant to be called by the motion path only |
Vector3f |
getDirection()
returns the direction the spatial is moving |
MotionTrack.Direction |
getDirectionType()
returns the direction type of the target |
MotionPath |
getPath()
retun the motion path this control follows |
Quaternion |
getRotation()
returns the rotation of the target |
Spatial |
getSpatial()
|
float |
getTraveledDistance()
return the distance traveled by the spatial on the path |
void |
initEvent(Application app,
Cinematic cinematic)
initialize this event (should be called internally only) |
void |
internalUpdate(float tpf)
should be used internally only |
boolean |
isEnabled()
|
boolean |
needsDirection()
this method is meant to be called by the motion path only |
void |
onPause()
place here the code you want to execute when the event is paused |
void |
onPlay()
Place here the code you want to execute when the event is started |
void |
onStop()
Place here the code you want to execute when the event is stoped. |
void |
onUpdate(float tpf)
Place here the code you want to execute on update (only called when the event is playing) |
void |
read(JmeImporter im)
for serialization only |
void |
render(RenderManager rm,
ViewPort vp)
Should be called prior to queuing the spatial by the RenderManager. |
void |
setCurrentValue(float currentValue)
this method is meant to be called by the motion path only |
void |
setCurrentWayPoint(int currentWayPoint)
this method is meant to be called by the motion path only |
void |
setDirection(Vector3f direction)
Sets the direction of the spatial This method is used by the motion path. |
void |
setDirectionType(MotionTrack.Direction directionType)
Sets the direction type of the target On each update the direction given to the target can have different behavior See the Direction Enum for explanations |
void |
setEnabled(boolean enabled)
|
void |
setLookAt(Vector3f lookAt,
Vector3f upVector)
Set the lookAt for the target This can be used only if direction Type is Direction.LookAt |
void |
setPath(MotionPath path)
Sets the motion path to follow |
void |
setRotation(Quaternion rotation)
sets the rotation of the target This can be used only if direction Type is Direction.PathAndRotation or Direction.Rotation With PathAndRotation the target will face the direction of the path multiplied by the given Quaternion. |
void |
setSpatial(Spatial spatial)
|
void |
setTime(float time)
When this method is invoked, the event should fast forward to the given time according tim 0 is the start of the event. |
void |
update(float tpf)
Updates the control. |
void |
write(JmeExporter ex)
for serialization only |
Methods inherited from class com.jme3.cinematic.events.AbstractCinematicEvent |
---|
addListener, getDuration, getInitialDuration, getLoopMode, getPlayState, getSpeed, getTime, pause, play, removeListener, setInitialDuration, setLoopMode, setSpeed, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Spatial spatial
protected int currentWayPoint
protected float currentValue
protected Vector3f direction
protected Vector3f lookAt
protected Vector3f upVector
protected Quaternion rotation
protected MotionTrack.Direction directionType
protected MotionPath path
protected float traveledDistance
Constructor Detail |
---|
public MotionTrack()
public MotionTrack(Spatial spatial, MotionPath path)
spatial
- path
- public MotionTrack(Spatial spatial, MotionPath path, float initialDuration)
spatial
- path
- public MotionTrack(Spatial spatial, MotionPath path, LoopMode loopMode)
spatial
- path
- public MotionTrack(Spatial spatial, MotionPath path, float initialDuration, LoopMode loopMode)
spatial
- path
- Method Detail |
---|
public void update(float tpf)
Control
update
in interface Control
tpf
- Time per frame.public void internalUpdate(float tpf)
AbstractCinematicEvent
internalUpdate
in interface CinematicEvent
internalUpdate
in class AbstractCinematicEvent
tpf
- time per framepublic void initEvent(Application app, Cinematic cinematic)
AbstractCinematicEvent
initEvent
in interface CinematicEvent
initEvent
in class AbstractCinematicEvent
app
- the applicationcinematic
- the cinematicpublic void setTime(float time)
AbstractCinematicEvent
setTime
in interface CinematicEvent
setTime
in class AbstractCinematicEvent
time
- the time to fast forward topublic void onUpdate(float tpf)
AbstractCinematicEvent
onUpdate
in class AbstractCinematicEvent
tpf
- time per framepublic void write(JmeExporter ex) throws java.io.IOException
AbstractCinematicEvent
write
in interface Savable
write
in class AbstractCinematicEvent
ex
- exporter
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
AbstractCinematicEvent
read
in interface Savable
read
in class AbstractCinematicEvent
im
- importer
java.io.IOException
public boolean needsDirection()
public Control cloneForSpatial(Spatial spatial)
cloneForSpatial
in interface Control
spatial
-
public void onPlay()
AbstractCinematicEvent
onPlay
in class AbstractCinematicEvent
public void onStop()
AbstractCinematicEvent
onStop
in class AbstractCinematicEvent
public void onPause()
AbstractCinematicEvent
onPause
in class AbstractCinematicEvent
public float getCurrentValue()
public void setCurrentValue(float currentValue)
public int getCurrentWayPoint()
public void setCurrentWayPoint(int currentWayPoint)
public Vector3f getDirection()
public void setDirection(Vector3f direction)
direction
- public MotionTrack.Direction getDirectionType()
public void setDirectionType(MotionTrack.Direction directionType)
directionType
- the direction typepublic void setLookAt(Vector3f lookAt, Vector3f upVector)
lookAt
- the position to look atupVector
- the up vectorpublic Quaternion getRotation()
public void setRotation(Quaternion rotation)
rotation
- the rotation quaternionpublic MotionPath getPath()
public void setPath(MotionPath path)
path
- public void setEnabled(boolean enabled)
public boolean isEnabled()
public void render(RenderManager rm, ViewPort vp)
Control
render
in interface Control
public void setSpatial(Spatial spatial)
setSpatial
in interface Control
spatial
- the spatial to be controlled. This should not be called
from user code.public Spatial getSpatial()
public float getTraveledDistance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |