com.jme3.animation
package contains various classes
for managing animation inside a jME3 application.See: Description
Interface | Description |
---|---|
AnimEventListener | Deprecated |
ClonableTrack | Deprecated |
Track | Deprecated |
Class | Description |
---|---|
Animation | Deprecated
use
AnimClip |
AnimationFactory | Deprecated
use
AnimFactory |
AnimationUtils | |
AnimChannel | Deprecated |
AnimControl | Deprecated
use
AnimComposer |
AudioTrack | Deprecated |
Bone | Deprecated
use
Joint |
BoneTrack | Deprecated
use
AnimTrack |
CompactArray<T> |
Object is indexed and stored in primitive float[]
|
CompactFloatArray |
Serialize and compress Float by indexing similar values
|
CompactQuaternionArray |
Serialize and compress
Quaternion [] by indexing same values
It is converted to float[] |
CompactVector3Array |
Serialize and compress Vector3f[] by indexing same values
|
EffectTrack | Deprecated |
EffectTrack.KillParticleControl | |
Pose | Deprecated |
PoseTrack | Deprecated |
PoseTrack.PoseFrame | |
Skeleton | Deprecated
use
Armature |
SkeletonControl | Deprecated
use
SkinningControl |
SpatialTrack | Deprecated |
TrackInfo | Deprecated |
Enum | Description |
---|---|
LoopMode | Deprecated |
com.jme3.animation
package contains various classes
for managing animation inside a jME3 application. Currently, the majority
of classes are for handling skeletal animation. The primary control class is
the AnimControl
, through which animations can be played,
looped, combined, transitioned, etc.
// Create or load a model with skeletal animation:
Spatial model = assetManager.loadModel("...");
// Retrieve the AnimControl.
AnimControl animCtrl = model.getControl(AnimControl.class);
// Create an animation channel, by default assigned to all bones.
AnimChannel animChan = animCtrl.createChannel();
// Play an animation
animChan.setAnim("MyAnim");
jME3 uses a system of bone-weights: A vertex is assigned up to 4 bones by which
it is influenced and 4 weights that describe how much the bone influences the
vertex. The maximum weight value being 1.0, and the requirement that all 4 weights
for a given vertex must sum to 1.0. This data is specified
for each skin/mesh that is influenced by the animation control via the
{link com.jme3.scene.VertexBuffer}s BoneWeight
and BoneIndex
.
The BoneIndex buffer must be of the format UnsignedByte
, thus
placing the limit of up to 256 bones for a skeleton. The BoneWeight buffer
should be of the format Float
. Both buffers should reference 4
bones, even if the maximum number of bones any vertex is influenced is less or more
than 4.
If a vertex is influenced by less than 4 bones, the indices following the last
valid bone should be 0 and the weights following the last valid bone should be 0.0.
The buffers are designed in such a way so as to permit hardware skinning.
The Skeleton
class describes a bone hierarchy with one
or more root bones having children, thus containing all bones of the skeleton.
In addition to accessing the bones in the skeleton via the tree hierarchy, it
is also possible to access bones via index. The index for any given bone is
arbitrary and does not depend on the bone's location in the tree hierarchy.
It is this index that is specified in the BoneIndex VertexBuffer mentioned above
, and is also used to apply transformations to the bones through the animations.
Every bone has a local and model space transformation. The local space
transformation is relative to its parent, if it has one, otherwise it is relative
to the model. The model space transformation is relative to model space.
The bones additionally have a bind pose transformation, which describes
the transformations for bones when no animated pose is applied to the skeleton.
All bones must have a bind pose transformation before they can be
animated. To set the bind pose for the skeleton, set the local (relative
to parent) transformations for all the bones using the call
Bone.setBindTransforms(com.jme3.math.Vector3f, com.jme3.math.Quaternion, com.jme3.math.Vector3f)
.
Then call Skeleton.updateWorldVectors()
followed by
Skeleton.setBindingPose()
.
Animations are stored in a HashMap object, accessed by name. An animation
is simply a list of tracks, each track describes a timeline with each keyframe
having a transformation. For bone animations, every track is assigned to a bone,
while for morph animations, every track is assigned to a mesh.