com.jme3.animation
Class Bone

java.lang.Object
  extended by com.jme3.animation.Bone
All Implemented Interfaces:
Savable

public final class Bone
extends java.lang.Object
implements Savable

Bone describes a bone in the bone-weight skeletal animation system. A bone contains a name and an index, as well as relevant transformation data.


Constructor Summary
Bone()
          Serialization only.
Bone(java.lang.String name)
          Creates a new bone with the given name.
 
Method Summary
 void addChild(Bone bone)
          Add a new child to this bone.
 java.util.ArrayList<Bone> getChildren()
          Returns all the children bones of this bone.
 Transform getCombinedTransform(Vector3f position, Quaternion rotation)
          Returns the local transform of this bone combined with the given position and rotation
 Vector3f getLocalPosition()
          Returns the local position of the bone, relative to the parent bone.
 Quaternion getLocalRotation()
          Returns the local rotation of the bone, relative to the parent bone.
 Vector3f getLocalScale()
          Returns the local scale of the bone, relative to the parent bone.
 Vector3f getModelSpacePosition()
          Returns the position of the bone in model space.
 Quaternion getModelSpaceRotation()
          Returns the rotation of the bone in model space.
 Vector3f getModelSpaceScale()
          Returns the scale of the bone in model space.
 java.lang.String getName()
          Returns the name of the bone, set in the constructor.
 Bone getParent()
          Returns parent bone of this bone, or null if it is a root bone.
 Vector3f getWorldBindInversePosition()
          Returns the inverse world bind pose position.
 Quaternion getWorldBindInverseRotation()
          Returns the inverse world bind pose rotation.
 Vector3f getWorldBindInverseScale()
          Returns the inverse world bind pose scale.
 Vector3f getWorldBindPosition()
          Returns the world bind pose position.
 Quaternion getWorldBindRotation()
          Returns the world bind pose rotation.
 Vector3f getWorldBindScale()
          Returns the world bind pose scale.
 void read(JmeImporter im)
           
 void setBindTransforms(Vector3f translation, Quaternion rotation, Vector3f scale)
          Sets local bind transform for bone.
 void setUserControl(boolean enable)
          If enabled, user can control bone transform with setUserTransforms.
 void setUserTransforms(Vector3f translation, Quaternion rotation, Vector3f scale)
          Sets user transform.
 void setUserTransformsWorld(Vector3f translation, Quaternion rotation)
          Must update all bones in skeleton for this to work.
 java.lang.String toString()
           
 void updateWorldVectors()
          Updates the world transforms for this bone, and, possibly the attach node if not null.
 void write(JmeExporter ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Bone

public Bone(java.lang.String name)
Creates a new bone with the given name.

Parameters:
name - Name to give to this bone

Bone

public Bone()
Serialization only. Do not use.

Method Detail

getName

public java.lang.String getName()
Returns the name of the bone, set in the constructor.

Returns:
The name of the bone, set in the constructor.

getParent

public Bone getParent()
Returns parent bone of this bone, or null if it is a root bone.

Returns:
The parent bone of this bone, or null if it is a root bone.

getChildren

public java.util.ArrayList<Bone> getChildren()
Returns all the children bones of this bone.

Returns:
All the children bones of this bone.

getLocalPosition

public Vector3f getLocalPosition()
Returns the local position of the bone, relative to the parent bone.

Returns:
The local position of the bone, relative to the parent bone.

getLocalRotation

public Quaternion getLocalRotation()
Returns the local rotation of the bone, relative to the parent bone.

Returns:
The local rotation of the bone, relative to the parent bone.

getLocalScale

public Vector3f getLocalScale()
Returns the local scale of the bone, relative to the parent bone.

Returns:
The local scale of the bone, relative to the parent bone.

getModelSpacePosition

public Vector3f getModelSpacePosition()
Returns the position of the bone in model space.

Returns:
The position of the bone in model space.

getModelSpaceRotation

public Quaternion getModelSpaceRotation()
Returns the rotation of the bone in model space.

Returns:
The rotation of the bone in model space.

getModelSpaceScale

public Vector3f getModelSpaceScale()
Returns the scale of the bone in model space.

Returns:
The scale of the bone in model space.

getWorldBindInversePosition

public Vector3f getWorldBindInversePosition()
Returns the inverse world bind pose position.

The bind pose transform of the bone is its "default" transform with no animation applied.

Returns:
the inverse world bind pose position.

getWorldBindInverseRotation

public Quaternion getWorldBindInverseRotation()
Returns the inverse world bind pose rotation.

The bind pose transform of the bone is its "default" transform with no animation applied.

Returns:
the inverse world bind pose rotation.

getWorldBindInverseScale

public Vector3f getWorldBindInverseScale()
Returns the inverse world bind pose scale.

The bind pose transform of the bone is its "default" transform with no animation applied.

Returns:
the inverse world bind pose scale.

getWorldBindPosition

public Vector3f getWorldBindPosition()
Returns the world bind pose position.

The bind pose transform of the bone is its "default" transform with no animation applied.

Returns:
the world bind pose position.

getWorldBindRotation

public Quaternion getWorldBindRotation()
Returns the world bind pose rotation.

The bind pose transform of the bone is its "default" transform with no animation applied.

Returns:
the world bind pose rotation.

getWorldBindScale

public Vector3f getWorldBindScale()
Returns the world bind pose scale.

The bind pose transform of the bone is its "default" transform with no animation applied.

Returns:
the world bind pose scale.

setUserControl

public void setUserControl(boolean enable)
If enabled, user can control bone transform with setUserTransforms. Animation transforms are not applied to this bone when enabled.


addChild

public void addChild(Bone bone)
Add a new child to this bone. Shouldn't be used by user code. Can corrupt skeleton.

Parameters:
bone - The bone to add

updateWorldVectors

public final void updateWorldVectors()
Updates the world transforms for this bone, and, possibly the attach node if not null.

The world transform of this bone is computed by combining the parent's world transform with this bones' local transform.


setUserTransforms

public void setUserTransforms(Vector3f translation,
                              Quaternion rotation,
                              Vector3f scale)
Sets user transform.


setUserTransformsWorld

public void setUserTransformsWorld(Vector3f translation,
                                   Quaternion rotation)
Must update all bones in skeleton for this to work.

Parameters:
translation -
rotation -

getCombinedTransform

public Transform getCombinedTransform(Vector3f position,
                                      Quaternion rotation)
Returns the local transform of this bone combined with the given position and rotation

Parameters:
position - a position
rotation - a rotation

setBindTransforms

public void setBindTransforms(Vector3f translation,
                              Quaternion rotation,
                              Vector3f scale)
Sets local bind transform for bone. Call setBindingPose() after all of the skeleton bones' bind transforms are set to save them.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException