Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::animation_player Class Reference

Class responsible for playing animations on a skeletal mesh. More...

#include <animation_player.h>

Public Types

using seconds_t = animation_clip::seconds_t
 
using update_callback_t
 

Public Member Functions

void blend_to (size_t layer_idx, const asset_handle< animation_clip > &clip, seconds_t duration=seconds_t(0.3), bool loop=true, bool phase_sync=false, const blend_easing_t &easing=math::linearInterpolation< float >)
 Blends to the animation over the specified time with the specified easing.
 
void clear (size_t layer_idx)
 
void set_blend_space (size_t layer_idx, const std::shared_ptr< blend_space_def > &blend_space, bool loop=true)
 
void set_blend_space_parameters (size_t layer_idx, const std::vector< float > &params)
 
auto play () -> bool
 Starts or resumes the animation playback.
 
void pause ()
 Pauses the animation playback.
 
void resume ()
 Resumes the animation playback.
 
void stop ()
 Stops the animation playback and resets the time.
 
auto update_time (seconds_t delta_time, bool force=false) -> bool
 Updates the animation player, advancing the animation time and applying transformations.
 
void update_poses (const animation_pose &ref_pose, const update_callback_t &set_transform_callback)
 
auto is_playing () const -> bool
 Returns whether the animation is currently playing.
 
auto is_paused () const -> bool
 Returns whether the animation is currently paused.
 

Detailed Description

Class responsible for playing animations on a skeletal mesh.

This class handles the playback of animations, interpolating between keyframes and applying the appropriate transformations to the nodes of a skeletal mesh.

Definition at line 83 of file animation_player.h.

Member Typedef Documentation

◆ seconds_t

◆ update_callback_t

Initial value:
std::function<void(const animation_pose::node_desc& desc,
const math::transform& abs,
const animation_pose::root_motion_result& motion_result)>
General purpose transformation class designed to maintain each component of the transformation separa...
Definition transform.hpp:27

Definition at line 87 of file animation_player.h.

Member Function Documentation

◆ blend_to()

void unravel::animation_player::blend_to ( size_t layer_idx,
const asset_handle< animation_clip > & clip,
seconds_t duration = seconds_t(0.3),
bool loop = true,
bool phase_sync = false,
const blend_easing_t & easing = math::linearInterpolation<float> )

Blends to the animation over the specified time with the specified easing.

Parameters
clipThe animation to blend to.
durationThe duration over which the blending must complete.
easingThe easing function used.

Definition at line 84 of file animation_player.cpp.

◆ clear()

void unravel::animation_player::clear ( size_t layer_idx)

Definition at line 78 of file animation_player.cpp.

◆ is_paused()

auto unravel::animation_player::is_paused ( ) const -> bool

Returns whether the animation is currently paused.

Returns
True if the animation is paused, false otherwise.

Definition at line 537 of file animation_player.cpp.

◆ is_playing()

auto unravel::animation_player::is_playing ( ) const -> bool

Returns whether the animation is currently playing.

Returns
True if the animation is playing, false otherwise.

Definition at line 532 of file animation_player.cpp.

◆ pause()

void unravel::animation_player::pause ( )

Pauses the animation playback.

Definition at line 163 of file animation_player.cpp.

◆ play()

auto unravel::animation_player::play ( ) -> bool

Starts or resumes the animation playback.

Definition at line 151 of file animation_player.cpp.

◆ resume()

void unravel::animation_player::resume ( )

Resumes the animation playback.

Definition at line 168 of file animation_player.cpp.

◆ set_blend_space()

void unravel::animation_player::set_blend_space ( size_t layer_idx,
const std::shared_ptr< blend_space_def > & blend_space,
bool loop = true )

Definition at line 127 of file animation_player.cpp.

◆ set_blend_space_parameters()

void unravel::animation_player::set_blend_space_parameters ( size_t layer_idx,
const std::vector< float > & params )

Definition at line 145 of file animation_player.cpp.

◆ stop()

void unravel::animation_player::stop ( )

Stops the animation playback and resets the time.

Definition at line 173 of file animation_player.cpp.

◆ update_poses()

void unravel::animation_player::update_poses ( const animation_pose & ref_pose,
const update_callback_t & set_transform_callback )

Definition at line 236 of file animation_player.cpp.

◆ update_time()

auto unravel::animation_player::update_time ( seconds_t delta_time,
bool force = false ) -> bool

Updates the animation player, advancing the animation time and applying transformations.

Parameters
delta_timeThe time to advance the animation by.
set_transform_callbackThe callback function to set the transform of a node.

Definition at line 185 of file animation_player.cpp.


The documentation for this class was generated from the following files: