com.jme.curve
Class CurveController

java.lang.Object
  extended by com.jme.scene.Controller
      extended by com.jme.curve.CurveController
All Implemented Interfaces:
Savable, java.io.Serializable

public class CurveController
extends Controller

CurveController defines a controller that moves a supplied Spatial object along a curve. Attributes of the curve are set such as the up vector (if not set, the spacial object will roll along the curve), the orientation precision defines how accurate the orientation of the spatial will be.

Version:
$Id: CurveController.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jme.scene.Controller
RT_CLAMP, RT_CYCLE, RT_WRAP
 
Constructor Summary
CurveController(Curve curve, Spatial mover)
          Constructor instantiates a new CurveController object.
CurveController(Curve curve, Spatial mover, float minTime, float maxTime)
          Constructor instantiates a new CurveController object.
 
Method Summary
 boolean isAutoRotating()
          isAutoRotating returns true if the object is rotating with the curve and false if it is not.
 void read(JMEImporter e)
           
 void reset()
           
 void setAutoRotation(boolean value)
          setAutoRotation determines if the object assigned to the controller will rotate with the curve or just following the curve.
 void setOrientationPrecision(float value)
          setOrientationPrecision sets a precision value for the spatials orientation.
 void setUpVector(Vector3f up)
          setUpVector sets the locking vector for the spatials up vector.
 void update(float time)
          update moves a spatial along the given curve for along a time period.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Controller
getClassTag, getControllerValues, getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, setActive, setControllerValues, setMaxTime, setMinTime, setRepeatType, setSpeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurveController

public CurveController(Curve curve,
                       Spatial mover)
Constructor instantiates a new CurveController object. The curve object that the controller operates on and the spatial object that is moved is specified during construction.

Parameters:
curve - the curve to operate on.
mover - the spatial to move.

CurveController

public CurveController(Curve curve,
                       Spatial mover,
                       float minTime,
                       float maxTime)
Constructor instantiates a new CurveController object. The curve object that the controller operates on and the spatial object that is moved is specified during construction. The game time to start and the game time to finish is also supplied.

Parameters:
curve - the curve to operate on.
mover - the spatial to move.
minTime - the time to start the controller.
maxTime - the time to end the controller.
Method Detail

setUpVector

public void setUpVector(Vector3f up)
setUpVector sets the locking vector for the spatials up vector. This prevents rolling along the curve and allows for a better tracking.

Parameters:
up - the vector to lock as the spatials up vector.

setOrientationPrecision

public void setOrientationPrecision(float value)
setOrientationPrecision sets a precision value for the spatials orientation. The smaller the number the higher the precision. By default 0.1 is used, and typically does not require changing.

Parameters:
value - the precision value of the spatial's orientation.

setAutoRotation

public void setAutoRotation(boolean value)
setAutoRotation determines if the object assigned to the controller will rotate with the curve or just following the curve.

Parameters:
value - true if the object is to rotate with the curve, false otherwise.

isAutoRotating

public boolean isAutoRotating()
isAutoRotating returns true if the object is rotating with the curve and false if it is not.

Returns:
true if the object is following the curve, false otherwise.

update

public void update(float time)
update moves a spatial along the given curve for along a time period.

Specified by:
update in class Controller
Parameters:
time - The time in seconds between the last call to update and the current one
See Also:
Controller.update(float)

reset

public void reset()

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class Controller
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class Controller
Throws:
java.io.IOException