group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
CharacterAnimator.cpp File Reference

Per-entity animator: state machine + sampling + blending + skin matrices. More...

#include "CharacterAnimator.hpp"
#include "AnimationLocomotion.hpp"
#include <SDL3/SDL_log.h>
#include <ozz/animation/runtime/animation.h>
#include <ozz/animation/runtime/blending_job.h>
#include <ozz/animation/runtime/local_to_model_job.h>
#include <ozz/animation/runtime/sampling_job.h>
#include <ozz/animation/runtime/skeleton.h>
#include <ozz/base/maths/soa_transform.h>
#include <ozz/base/span.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/mat4x4.hpp>
#include <initializer_list>
#include <limits>
#include <vector>
Include dependency graph for CharacterAnimator.cpp:

Classes

struct  CharacterAnimator::Impl

Functions

float computeIdleGroundedMinY (const CharacterRig &rig, const AnimationLibrary &library, const glm::quat &, float bindMeshMinY)
 Grounding reference that aligns the IDLE pose's feet with the floor.

Detailed Description

Per-entity animator: state machine + sampling + blending + skin matrices.

Function Documentation

◆ computeIdleGroundedMinY()

float computeIdleGroundedMinY ( const CharacterRig & rig,
const AnimationLibrary & library,
const glm::quat & orientationFix,
float bindMeshMinY )
nodiscard

Grounding reference that aligns the IDLE pose's feet with the floor.

The renderer grounds a character by aligning the rig's bind-pose lowest vertex (bindMeshMinY) with the bottom of the collision AABB. Mixamo clips bend the knees slightly, so the animated feet sit a constant amount above the straight-legged T-pose bind — grounding off the bind makes every clip appear lifted by that amount. This samples the Idle clip once and returns bindMeshMinY shifted by the idle-vs-bind foot-joint Y delta, so all clips (which share the idle floor reference) sit on the ground. Falls back to bindMeshMinY if the rig has no recognisable foot joints or no Idle clip.

Parameters
orientationFixSame rotation passed to CharacterRig::loadFromFBX, so the bind foot positions are measured in the rendered frame.
Here is the call graph for this function:
Here is the caller graph for this function: