Constructor and Description |
---|
MotionPath()
Create a motion Path
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(MotionPathListener listener)
Adds a motion pathListener to the path
|
void |
addWayPoint(Vector3f wayPoint)
Add a waypoint to the path
|
void |
checkWayPoint(MotionEvent control,
float tpf) |
void |
clearWayPoints() |
void |
disableDebugShape()
disable the display of the path and the waypoints
|
void |
enableDebugShape(AssetManager manager,
Node rootNode)
enable the display of the path and the waypoints
|
float |
getCurveTension()
Returns the curve tension
|
float |
getLength()
Return the length of the path in world units
|
int |
getNbWayPoints()
return the number of waypoints of this path
|
Spline.SplineType |
getPathSplineType()
return the type of spline used for the path interpolation for this path
|
Spline |
getSpline() |
Vector3f |
getWayPoint(int i)
returns the waypoint at the given index
|
Vector2f |
getWayPointIndexForDistance(float distance,
Vector2f store)
compute the index of the waypoint and the interpolation value according to a distance
returns a vector 2 containing the index in the x field and the interpolation value in the y field
|
float |
interpolatePath(float time,
MotionEvent control,
float tpf)
interpolate the path giving the time since the beginning and the motionControl
this methods sets the new localTranslation to the spatial of the MotionEvent control.
|
boolean |
isCycle()
returns true if the path is a cycle
|
java.util.Iterator<Vector3f> |
iterator()
returns an iterator on the waypoints collection
|
void |
read(JmeImporter im) |
void |
removeListener(MotionPathListener listener)
remove the given listener
|
void |
removeWayPoint(int i)
remove the waypoint at the given index from the path
|
void |
removeWayPoint(Vector3f wayPoint)
remove the waypoint from the path
|
void |
setCurveTension(float curveTension)
sets the tension of the curve (only for catmull rom) 0.0 will give a linear curve, 1.0 a round curve
|
void |
setCycle(boolean cycle)
Sets the path to be a cycle
|
void |
setPathSplineType(Spline.SplineType pathSplineType)
sets the type of spline used for the path interpolation for this path
|
void |
triggerWayPointReach(int wayPointIndex,
MotionEvent control) |
void |
write(JmeExporter ex) |
public float interpolatePath(float time, MotionEvent control, float tpf)
time
- the time since the animation startedcontrol
- the control over the moving spatialpublic void checkWayPoint(MotionEvent control, float tpf)
public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
public Vector2f getWayPointIndexForDistance(float distance, Vector2f store)
distance
- the distance traveled on this pathpublic void addWayPoint(Vector3f wayPoint)
wayPoint
- a position in world spacepublic float getLength()
public Vector3f getWayPoint(int i)
i
- the indexpublic void removeWayPoint(Vector3f wayPoint)
wayPoint
- the waypoint to removepublic void removeWayPoint(int i)
i
- the index of the waypoint to removepublic java.util.Iterator<Vector3f> iterator()
public Spline.SplineType getPathSplineType()
public void setPathSplineType(Spline.SplineType pathSplineType)
pathSplineType
- public void disableDebugShape()
public void enableDebugShape(AssetManager manager, Node rootNode)
manager
- the assetManagerrootNode
- the node where the debug shapes must be attachedpublic void addListener(MotionPathListener listener)
listener
- the MotionPathListener to attachpublic void removeListener(MotionPathListener listener)
listener
- the listener to removepublic int getNbWayPoints()
public void triggerWayPointReach(int wayPointIndex, MotionEvent control)
public float getCurveTension()
public void setCurveTension(float curveTension)
curveTension
- public void clearWayPoints()
public void setCycle(boolean cycle)
cycle
- public boolean isCycle()
public Spline getSpline()