Package com.jme3.anim
Class Joint
java.lang.Object
com.jme3.anim.Joint
- All Implemented Interfaces:
HasLocalTransform
,Savable
,JmeCloneable
,Cloneable
A Joint is the basic component of an armature designed to perform skeletal animation
Created by Nehon on 15/12/2017.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the specified Joint as a child.void
Sets the local transform with the bind transformsprotected void
Sets the local transform with the initial transformvoid
cloneFields
(Cloner cloner, Object original) Callback fromCloner
to convert this shallow-cloned Joint into a deep-cloned one, using the specified Cloner and original to resolve copied fields.protected Node
getAttachmentsNode
(int jointIndex, SafeArrayList<Geometry> targets) Access the attachments node of this joint.Access the list of child joints.int
getId()
Determine this joint's index in the Armature that contains it.Access the initial transform.Determine the inverse model bind matrix.protected JointModelTransform
Access the accumulated model transform.Access the local rotation.Access the local scale vector.Access the local transform.Access the local translation vector.Determine the model transform.getName()
Determine the name.protected void
getOffsetTransform
(Matrix4f outTransform) Stores the skinning transform in the specified Matrix4f.Access the parent joint.jmeClone()
Create a shallow clone for the JME cloner.void
read
(JmeImporter im) De-serialize this Joint from the specified importer, for example when loading from a J3O file.protected void
Sets the current localTransform as the Bind transform.protected void
Sets the current local transforms as the initial transform.void
setId
(int id) Alter this joint's index in the Armature that contains it.void
setInverseModelBindMatrix
(Matrix4f inverseModelBindMatrix) Replace the inverse model bind matrix.protected void
setJointModelTransform
(JointModelTransform jointModelTransform) Replace the accumulated model transform.void
setLocalRotation
(Quaternion rotation) Alter the local rotation.void
setLocalScale
(Vector3f scale) Alter the local scale vector.void
setLocalTransform
(Transform localTransform) Alter the local transform.void
setLocalTranslation
(Vector3f translation) Alter the local translation vector.void
Alter the name.final void
update()
Updates world transforms for this bone and its children.final void
Updates the model transforms for this bone and for the attachments node if not null.void
write
(JmeExporter ex) Serialize this Joint to the specified exporter, for example when saving to a J3O file.
-
Constructor Details
-
Joint
public Joint()Instantiate a nameless Joint. -
Joint
Instantiate a Joint with the specified name.- Parameters:
name
- the desired name
-
-
Method Details
-
update
public final void update()Updates world transforms for this bone and its children. -
updateModelTransforms
public final void updateModelTransforms()Updates the model transforms for this bone and for the attachments node if not null.The model transform of this bone is computed by combining the parent's model transform with this bone's local transform.
-
getOffsetTransform
Stores the skinning transform in the specified Matrix4f. The skinning transform applies the animation of the bone to a vertex.This assumes that the world transforms for the entire bone hierarchy have already been computed, otherwise this method will return undefined results.
- Parameters:
outTransform
- storage for the result (modified)
-
saveBindPose
protected void saveBindPose()Sets the current localTransform as the Bind transform. -
saveInitialPose
protected void saveInitialPose()Sets the current local transforms as the initial transform. -
applyBindPose
public void applyBindPose()Sets the local transform with the bind transforms -
applyInitialPose
protected void applyInitialPose()Sets the local transform with the initial transform -
getJointModelTransform
Access the accumulated model transform.- Returns:
- the pre-existing instance
-
setJointModelTransform
Replace the accumulated model transform.- Parameters:
jointModelTransform
- the transform to use (alias created)
-
getLocalTranslation
Access the local translation vector.- Returns:
- the pre-existing vector
-
getLocalRotation
Access the local rotation.- Returns:
- the pre-existing Quaternion
-
getLocalScale
Access the local scale vector.- Returns:
- the pre-existing vector
-
setLocalTranslation
Alter the local translation vector.- Parameters:
translation
- the desired offset vector (not null, unaffected)
-
setLocalRotation
Alter the local rotation.- Parameters:
rotation
- the desired rotation (not null, unaffected)
-
setLocalScale
Alter the local scale vector.- Parameters:
scale
- the desired scale factors (not null, unaffected)
-
addChild
Add the specified Joint as a child.- Parameters:
child
- the Joint to add (not null, modified)
-
setName
Alter the name.- Parameters:
name
- the desired name
-
setLocalTransform
Alter the local transform.- Specified by:
setLocalTransform
in interfaceHasLocalTransform
- Parameters:
localTransform
- the desired Transform (not null, unaffected)
-
setInverseModelBindMatrix
Replace the inverse model bind matrix.- Parameters:
inverseModelBindMatrix
- the matrix to use (alias created)
-
getName
Determine the name.- Returns:
- the name
-
getParent
Access the parent joint.- Returns:
- the pre-existing instance, or null if this is a root joint
-
getChildren
Access the list of child joints.- Returns:
- the pre-existing list
-
getAttachmentsNode
Access the attachments node of this joint. If this joint doesn't already have an attachments node, create one. Models and effects attached to the attachments node will follow this bone's motions.- Parameters:
jointIndex
- this bone's index in its armature (≥0)targets
- a list of geometries animated by this bone's skeleton (not null, unaffected)- Returns:
- the attachments node (not null)
-
getInitialTransform
Access the initial transform.- Returns:
- the pre-existing instance
-
getLocalTransform
Access the local transform.- Specified by:
getLocalTransform
in interfaceHasLocalTransform
- Returns:
- the pre-existing instance
-
getModelTransform
Determine the model transform.- Returns:
- a shared instance
-
getInverseModelBindMatrix
Determine the inverse model bind matrix.- Returns:
- the pre-existing instance
-
getId
public int getId()Determine this joint's index in the Armature that contains it.- Returns:
- an index (≥0)
-
setId
public void setId(int id) Alter this joint's index in the Armature that contains it.- Parameters:
id
- the desired index (≥0)
-
jmeClone
Create a shallow clone for the JME cloner.- Specified by:
jmeClone
in interfaceJmeCloneable
- Returns:
- a new instance
-
cloneFields
Callback fromCloner
to convert this shallow-cloned Joint into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFields
in interfaceJmeCloneable
- Parameters:
cloner
- the Cloner that's cloning this Joint (not null)original
- the instance from which this Joint was shallow-cloned (not null, unaffected)
-
read
De-serialize this Joint from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfaceSavable
- Parameters:
im
- the importer to use (not null)- Throws:
IOException
- from the importer
-
write
Serialize this Joint to the specified exporter, for example when saving to a J3O file.- Specified by:
write
in interfaceSavable
- Parameters:
ex
- the exporter to write to (not null)- Throws:
IOException
- from the exporter
-