Package com.jme3.cinematic
Class MotionPath
java.lang.Object
com.jme3.cinematic.MotionPath
- All Implemented Interfaces:
- Savable
Motion path is used to create a path between way points.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddListener(MotionPathListener listener) Adds a motion pathListener to the pathvoidaddWayPoint(Vector3f wayPoint) Add a waypoint to the pathvoidcheckWayPoint(MotionEvent control, float tpf) voidvoiddisable the display of the path and the waypointsvoidenableDebugShape(AssetManager manager, Node rootNode) enable the display of the path and the waypointsfloatReturns the curve tensionfloatReturn the length of the path in world unitsintreturn the number of waypoints of this pathreturn the type of spline used for the path interpolation for this pathgetWayPoint(int i) returns the waypoint at the given indexgetWayPointIndexForDistance(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 fieldfloatinterpolatePath(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.booleanisCycle()returns true if the path is a cycleiterator()returns an iterator on the waypoints collectionvoidread(JmeImporter im) voidremoveListener(MotionPathListener listener) remove the given listenervoidremoveWayPoint(int i) remove the waypoint at the given index from the pathvoidremoveWayPoint(Vector3f wayPoint) remove the waypoint from the pathvoidsetCurveTension(float curveTension) sets the tension of the curve (only for catmull rom) 0.0 will give a linear curve, 1.0 a round curvevoidsetCycle(boolean cycle) Sets the path to be a cyclevoidsetPathSplineType(Spline.SplineType pathSplineType) sets the type of spline used for the path interpolation for this pathvoidtriggerWayPointReach(int wayPointIndex, MotionEvent control) voidwrite(JmeExporter ex) 
- 
Constructor Details- 
MotionPathpublic MotionPath()Create a motion Path
 
- 
- 
Method Details- 
interpolatePathinterpolate the path giving the time since the beginning and the motionControl this methods sets the new localTranslation to the spatial of the MotionEvent control.- Parameters:
- time- the time since the animation started
- control- the control over the moving spatial
- tpf- time per frame (in seconds)
- Returns:
- the distance travelled (in world units)
 
- 
checkWayPoint
- 
write- Specified by:
- writein interface- Savable
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Throws:
- IOException
 
- 
getWayPointIndexForDistancecompute 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- Parameters:
- distance- the distance traveled on this path
- store- storage for the result (not null, modified)
- Returns:
- the waypoint index and the interpolation value in a vector2
 
- 
addWayPointAdd a waypoint to the path- Parameters:
- wayPoint- a position in world space
 
- 
getLengthpublic float getLength()Return the length of the path in world units- Returns:
- the length
 
- 
getWayPointreturns the waypoint at the given index- Parameters:
- i- the index
- Returns:
- returns the waypoint position
 
- 
removeWayPointremove the waypoint from the path- Parameters:
- wayPoint- the waypoint to remove
 
- 
removeWayPointpublic void removeWayPoint(int i) remove the waypoint at the given index from the path- Parameters:
- i- the index of the waypoint to remove
 
- 
iteratorreturns an iterator on the waypoints collection- Returns:
- an iterator
 
- 
getPathSplineTypereturn the type of spline used for the path interpolation for this path- Returns:
- the path interpolation spline type
 
- 
setPathSplineTypesets the type of spline used for the path interpolation for this path- Parameters:
- pathSplineType- the desired type
 
- 
disableDebugShapepublic void disableDebugShape()disable the display of the path and the waypoints
- 
enableDebugShapeenable the display of the path and the waypoints- Parameters:
- manager- the assetManager
- rootNode- the node where the debug shapes must be attached
 
- 
addListenerAdds a motion pathListener to the path- Parameters:
- listener- the MotionPathListener to attach
 
- 
removeListenerremove the given listener- Parameters:
- listener- the listener to remove
 
- 
getNbWayPointspublic int getNbWayPoints()return the number of waypoints of this path- Returns:
- the count (≥0)
 
- 
triggerWayPointReach
- 
getCurveTensionpublic float getCurveTension()Returns the curve tension- Returns:
- the curve tension
 
- 
setCurveTensionpublic 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- Parameters:
- curveTension- the desired value
 
- 
clearWayPointspublic void clearWayPoints()
- 
setCyclepublic void setCycle(boolean cycle) Sets the path to be a cycle- Parameters:
- cycle- true for a cycle, false for a non-cycle
 
- 
isCyclepublic boolean isCycle()returns true if the path is a cycle- Returns:
- true if the path is a cycle
 
- 
getSpline
 
-