A constructor defined in BBMOD_AnimationPlayer.gml
Implements BBMOD_IEventListener, BBMOD_IRenderable
new BBMOD_AnimationPlayer(_model[, _paused])
An animation player. Each instance of an animated model should have its own animation player.
Name | Type | Description |
---|---|---|
_model | Struct.BBMOD_Model |
A model that the animation player animates. |
_paused | Bool |
If true then the animation player is created as paused. Defaults to false . |
Name | Description |
---|---|
Animation | The currently playing animation or undefined . |
AnimationLoops | If true then BBMOD_AnimationPlayer.Animation loops. |
EnableTransitions | If true then transitions between animations are enabled. The default value is true . |
Frameskip | Number of frames (calls to BBMOD_AnimationPlayer.update) to skip. Defaults to 0 (frame skipping is disabled). Increasing the value increases performance. Use infinity to disable computing animation frames entirely. |
Model | A model that the animation player animates. |
Paused | If true , then the animation playback is paused. |
PlaybackSpeed | Controls animation playback speed. Must be a positive number! |
Time | The current animation playback time. |
Name | Description |
---|---|
change | Starts playing an animation from its start, only if it is a different one that the last played animation. |
get_node_transform | Returns a transformation (dual quaternion) of a node, which can be used for example for attachments. |
get_node_transform_from_frame | Returns a transformation (dual quaternion) of a node from the last animation frame. This is useful if you want to add additional transformations onto an animated bone, instead of competely replacing it. |
get_transform | Returns an array of current transformations of all bones. This should be passed to a vertex shader. |
off_event | Removes event listeners. |
on_event | Adds a listener for a specific event. |
play | Starts playing an animation from its start. |
render | Enqueues the animated model for rendering. |
set_node_position | Overrides a position of a node. |
set_node_rotation | Overrides a rotation of a node. |
set_node_rotation_post | Sets a post-rotation of a node. |
submit | Immediately submits the animated model for rendering. |
trigger_event | Triggers an event in the event listener. |
update | Updates the animation player. This should be called every frame in the step event. |
Following code shows how to load models and animations in a resource manager object and then play animations in multiple instances of another object.
/// @desc Create event of OResourceManager
modCharacter = new BBMOD_Model("character.bbmod");
animIdle = new BBMOD_Animation("idle.bbanim");
/// @desc Create event of OCharacter
model = OResourceManager.modCharacter;
animationPlayer = new BBMOD_AnimationPlayer(model);
animationPlayer.play(OResourceManager.animIdle, true);
/// @desc Step event of OCharacter
animationPlayer.update(delta_time);
/// @desc Draw event of OCharacter
animationPlayer.render();
bbmod_material_reset();
BBMOD_Animation, BBMOD_AnimationInstance, BBMOD_AnimationState, BBMOD_AnimationStateMachine
Copyright © 2024, BlueBurn. Built on September 07, 2024 using GMDoc.