SkeletonNode

public class SkeletonNode

A Node that provides mappings between the bones of a skinned ModelRenderable and a set of Nodes.

When an animation is playing, the transform of the attached Nodes will be set during onUpdate(FrameTime).

Manipulating attached Nodes will also transform corresponding bones. Child bones will not automatically be transformed. To change the transformations of child bones, the child bones will need to be attached to child nodes. If an animation is playing, the node and bone will be set to the animation state each frame during onUpdate(FrameTime). However, attached Nodes can be manipulated after onUpdate(FrameTime) each frame to manipulate bones while an animation is playing.

When the attached Node's isActive() is false, they are not transformed and don't transform bones.

The attached Nodes are also not transformed if they are bound to a boneName that doesn't match any bones in the ModelRenderable.

Calling setRenderable(Renderable) will not change the Node mappings. The attached Nodes' transforms will immediately be set to the pose of matching bones in the new ModelRenderable.

Public Constructors

Public Methods

Node
getBoneAttachment(String boneName)
Returns the Node attached to the specified bone.
void
onUpdate(FrameTime frameTime)
Handles when this node is updated.
void
setBoneAttachment(String boneName, Node node)
Attaches a Node to the specified boneName.
void
setRenderable(Renderable renderable)
Sets the Renderable to display for this node.

Inherited Methods

Public Constructors

public SkeletonNode ()

Public Methods

public Node getBoneAttachment (String boneName)

Returns the Node attached to the specified bone. If there is no Node attached to this bone, returns null.

Parameters
boneName

public void onUpdate (FrameTime frameTime)

Handles when this node is updated. A node is updated before rendering each frame. This is only called when the node is active.

Override to perform any updates that need to occur each frame.

Parameters
frameTime provides time information for the current frame

public void setBoneAttachment (String boneName, Node node)

Attaches a Node to the specified boneName. This will immediately set the transform of the Node to the pose of the bone named boneName in getRenderable() if it exists.

If the Node is null, then any previously attached Node will be detached. Only one Node may be attached to a boneName at a time.

Parameters
boneName
node

public void setRenderable (Renderable renderable)

Sets the Renderable to display for this node. If setCollisionShape(CollisionShape) is not set, then getCollisionShape() is used to detect collisions for this Node.

Parameters
renderable Usually a 3D model. If null, this node's current renderable will be removed.