com.jme.animation
Class JointController

java.lang.Object
  extended bycom.jme.scene.Controller
      extended bycom.jme.animation.JointController
All Implemented Interfaces:
java.io.Serializable

public class JointController
extends Controller

Started Date: Jun 9, 2004
This controller animates a Node's JointMesh children acording to the joints stored inside movementInfo.

Author:
Jack Lindamood
See Also:
Serialized Form

Nested Class Summary
 class JointController.PointInTime
          At a point in time is defined by time .
 
Field Summary
 float FPS
          Currently unused.
 TransformMatrix[] localRefMatrix
          Local refrence matrix that can determine a joint's position in space relative to its parent.
 java.util.ArrayList movementInfo
          movementInfo[i] contains a float value time and an array of TransformMatrix.
 java.util.ArrayList movingMeshes
          Array of all the meshes this controller should consider animating.
 int numJoints
          It is JointController's responsibility to keep changePoints sorted by time at all times.
 int[] parentIndex
          parentIndex contains a list of who's parent a joint is.
 float skipRate
          Tells update that it should be called every skipRate seconds
 
Fields inherited from class com.jme.scene.Controller
RT_CLAMP, RT_CYCLE, RT_WRAP
 
Constructor Summary
JointController(int numJoints)
          Constructs a new JointController that will hold the given number of joints.
 
Method Summary
 void addJointMesh(JointMesh child)
          Adds a jointmesh for this JointController to consider animating.
 boolean getModelUpdate()
          Returns true if the model's bounding volume is being updated every frame.
 void processController()
          Processes a JointController by filling holes and creating inverse matrixes.
 Controller putClone(Controller store, CloneCreator properties)
          This function should be overridden by any Spatial objects that want their Controller cloned by a CloneCreator.
 void setModelUpdate(boolean update)
          If true, the model's bounding volume will be updated every frame.
 void setRotation(int jointNumber, float time, float x, float y, float z)
          Tells JointController that at time time the joint jointNumber will rotate acording to the euler angles x,y,z relative to its parent's rotation
 void setRotation(int jointNumber, float time, Quaternion quaternion)
          Tells JointController that at time time the joint jointNumber will rotate acording to Quaternion.
 void setTimes(int start, int end)
          Sets the frames the joint controller will animate from and to.
 void setTranslation(int jointNumber, float time, float x, float y, float z)
          Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent
 void setTranslation(int jointNumber, float time, Vector3f trans)
          Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent
 void update(float time)
          Updates the movingMeshes by updating their joints +=time
 
Methods inherited from class com.jme.scene.Controller
getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, setActive, setMaxTime, setMinTime, setRepeatType, setSpeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numJoints

public int numJoints
It is JointController's responsibility to keep changePoints sorted by time at all times.


movementInfo

public java.util.ArrayList movementInfo
movementInfo[i] contains a float value time and an array of TransformMatrix. At time time the joint i is at movement jointChange[i]


parentIndex

public int[] parentIndex
parentIndex contains a list of who's parent a joint is. -1 indicates a root joint with no parent


localRefMatrix

public TransformMatrix[] localRefMatrix
Local refrence matrix that can determine a joint's position in space relative to its parent.


FPS

public float FPS
Currently unused.


movingMeshes

public java.util.ArrayList movingMeshes
Array of all the meshes this controller should consider animating.


skipRate

public float skipRate
Tells update that it should be called every skipRate seconds

Constructor Detail

JointController

public JointController(int numJoints)
Constructs a new JointController that will hold the given number of joints.

Parameters:
numJoints - The number of joints this jointController will have
Method Detail

setTranslation

public void setTranslation(int jointNumber,
                           float time,
                           float x,
                           float y,
                           float z)
Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
x - Joint's x translation
y - Joint's y translation
z - Joint's z translation

setTranslation

public void setTranslation(int jointNumber,
                           float time,
                           Vector3f trans)
Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
trans - Joint's translation

setRotation

public void setRotation(int jointNumber,
                        float time,
                        float x,
                        float y,
                        float z)
Tells JointController that at time time the joint jointNumber will rotate acording to the euler angles x,y,z relative to its parent's rotation

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
x - Joint's x rotation
y - Joint's y rotation
z - Joint's z rotation

setRotation

public void setRotation(int jointNumber,
                        float time,
                        Quaternion quaternion)
Tells JointController that at time time the joint jointNumber will rotate acording to Quaternion.

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
quaternion - The joint's new rotation

update

public void update(float time)
Updates the movingMeshes by updating their joints +=time

Specified by:
update in class Controller
Parameters:
time - Time from last update

setTimes

public void setTimes(int start,
                     int end)
Sets the frames the joint controller will animate from and to. The frames are dependant upon the FPS. Remember that the first frame starts at 1, NOT 0.

Parameters:
start - The starting frame number.
end - The ending frame number.

processController

public void processController()
Processes a JointController by filling holes and creating inverse matrixes. Should only be called once per JointController object lifetime


setModelUpdate

public void setModelUpdate(boolean update)
If true, the model's bounding volume will be updated every frame. If false, it will not.

Parameters:
update - The new update model volume per frame value.

getModelUpdate

public boolean getModelUpdate()
Returns true if the model's bounding volume is being updated every frame.

Returns:
True if bounding volume is updating.

addJointMesh

public void addJointMesh(JointMesh child)
Adds a jointmesh for this JointController to consider animating.

Parameters:
child - Child JointMesh to consider

putClone

public Controller putClone(Controller store,
                           CloneCreator properties)
Description copied from class: Controller
This function should be overridden by any Spatial objects that want their Controller cloned by a CloneCreator. It stores into "store" the properties of this Controller.

Overrides:
putClone in class Controller
Parameters:
store - The Controller to store properties into. If null, null is returned.
properties - The CloneCreator controlling how things should be copied into the store Controller.
Returns:
The store controller, after a copy.