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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the specified Joint as a child.voidSets the local transform with the bind transformsprotected voidSets the local transform with the initial transformvoidcloneFields(Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned Joint into a deep-cloned one, using the specified Cloner and original to resolve copied fields.protected NodegetAttachmentsNode(int jointIndex, SafeArrayList<Geometry> targets) Access the attachments node of this joint.Access the list of child joints.intgetId()Determine this joint's index in the Armature that contains it.Access the initial transform.Determine the inverse model bind matrix.protected JointModelTransformAccess 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 voidgetOffsetTransform(Matrix4f outTransform) Stores the skinning transform in the specified Matrix4f.Access the parent joint.jmeClone()Create a shallow clone for the JME cloner.voidread(JmeImporter im) De-serialize this Joint from the specified importer, for example when loading from a J3O file.protected voidSets the current localTransform as the Bind transform.protected voidSets the current local transforms as the initial transform.voidsetId(int id) Alter this joint's index in the Armature that contains it.voidsetInverseModelBindMatrix(Matrix4f inverseModelBindMatrix) Replace the inverse model bind matrix.protected voidsetJointModelTransform(JointModelTransform jointModelTransform) Replace the accumulated model transform.voidsetLocalRotation(Quaternion rotation) Alter the local rotation.voidsetLocalScale(Vector3f scale) Alter the local scale vector.voidsetLocalTransform(Transform localTransform) Alter the local transform.voidsetLocalTranslation(Vector3f translation) Alter the local translation vector.voidAlter the name.final voidupdate()Updates world transforms for this bone and its children.final voidUpdates the model transforms for this bone and for the attachments node if not null.voidwrite(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:
setLocalTransformin 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:
getLocalTransformin 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:
jmeClonein interfaceJmeCloneable- Returns:
- a new instance
-
cloneFields
Callback fromClonerto convert this shallow-cloned Joint into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin 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:
readin 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:
writein interfaceSavable- Parameters:
ex- the exporter to write to (not null)- Throws:
IOException- from the exporter
-