ozz-animation

Samples - Motion extraction

View motion_extraction sample source code.

Description

Extracting root motion is the process of capturing character motion (translation and rotation) from an animation. This motion is re-applied at runtime to drive the character and its collision capsule. This sample allows to tweak motion extraction settings by exposing all the parameters available to the motion extraction utility.

Initializing WebGL

Concept

The samples relies ozz::animation::offline::MotionExtractor utility to run motion extraction and exposes all its parameters. The utility capture root motion from a raw animation into tracks (translation and rotation) that are use at runtime to sample character location using ozz::animation::offline::TrackSamplingJob.

Sample usage

This samples allows to tweak motion extraction using all utility parameters:

Implementation

  1. Import the runtime skeleton and a raw animation objects. These are imported from files as described in the “how to load an object from a file” section. Note that the animation is still in an offline format at this stage.
  2. Extract motion from the raw animation using ozz::animation::offline::MotionExtractor utility, into a ozz::animation::offline::RawFloat3Track for the position and ozz::animation::offline::RawQuaternionTrack for the rotation.
  3. Optimizes the raw animation and the 2 raw tracks using ozz::animation::offline::AnimationOptimizer and ozz::animation::offline::TrackOptimizer.
  4. Builds runtime animation and the 2 runtime tracks using ozz::animation::offline::AnimationBuilder and ozz::animation::offline::TrackBuilder.
  5. At runtime, sample animation and convert it to model space as usual. See “playback” sample for more details.
  6. Samples the 2 position and rotation tracks, using ozz::animation::offline::TrackSamplingJob.
  7. Renders character at the position and rotation sampled from the tracks.