Nudge Physics
A single file, header-only 3D physics library
Loading...
Searching...
No Matches
nudge::KinematicData::Animation Struct Reference

The Animation class. Each animation owns a (kinematic) body index and a range of key frames. More...

#include <nudge.h>

Public Types

enum  LoopMode { LM_NO_LOOP , LM_LOOP_NORMAL , LM_LOOP_PING_PONG }
 

Public Attributes

float play_time
 
float offset_time
 
float speed
 
float total_time
 
Transform baseT
 
uint32_t key_frame_start
 
uint32_t key_frame_count
 
uint32_t body
 
bool playing
 
bool use_baseT
 
enum nudge::KinematicData::Animation::LoopMode loop_mode
 

Detailed Description

The Animation class. Each animation owns a (kinematic) body index and a range of key frames.

Note
Each animation use (or reuse) a chunk of the key_frame array. The same chunk (i.e. range of key frames) can be used by more than one Animation (i.e. body), because each Animation can have an offset transform (baseT) and/or an offset time (offset_time).
Animations referencing removed bodies (by default) are assigned to NUDGE_INVALID_BODY_ID (and skipped) next time simulation_step(...) is called (this behavior can be changed using the definition NUDGE_DELETE_KINEMATIC_ANIMATIONS_REFERENCING_REMOVED_BODIES).
So by default it's safe to store animation indices (unless we manually delete animations, or define NUDGE_DELETE_KINEMATIC_ANIMATIONS_REFERENCING_REMOVED_BODIES).
Using static/dynamic bodies in kinematic animations is something never tested (undefined behavior).

Member Enumeration Documentation

◆ LoopMode

Enumerator
LM_NO_LOOP 

normal mode

LM_LOOP_NORMAL 

at the end, animation restarts

LM_LOOP_PING_PONG 

at the end, animation goes back and forth

Member Data Documentation

◆ play_time

float nudge::KinematicData::Animation::play_time

[read] animation current time of play

◆ offset_time

float nudge::KinematicData::Animation::offset_time

if set, animation starts after offset_time

◆ speed

float nudge::KinematicData::Animation::speed

tweakable animation speed (can be negative)

◆ total_time

float nudge::KinematicData::Animation::total_time

total duration of the animation (if negative, value is refreshed before playing it)

◆ baseT

Transform nudge::KinematicData::Animation::baseT

offset transform used if use_baseT is set

◆ key_frame_start

uint32_t nudge::KinematicData::Animation::key_frame_start

start animation key_frame index

◆ key_frame_count

uint32_t nudge::KinematicData::Animation::key_frame_count

num key_frame indices (from key_frame_start)

◆ body

uint32_t nudge::KinematicData::Animation::body

index of the kinematic body to be animated

◆ playing

bool nudge::KinematicData::Animation::playing

true if animation is playing

◆ use_baseT

bool nudge::KinematicData::Animation::use_baseT

activates the offset transform baseT

◆ loop_mode

enum nudge::KinematicData::Animation::LoopMode nudge::KinematicData::Animation::loop_mode

animation loop mode


The documentation for this struct was generated from the following file: