Vixen
02b45cc4
csharp
public sealed class Animator

One character's animation: the layers, the parameters they read, the pose they produce, and what came out of it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The façade the rest of the engine talks to. Everything under it — clips, blend trees, state machines, masks — is reachable and testable on its own, and a game that only wants "play this, blend to that, tell me when a foot lands" never has to meet any of it.

One update produces everything. The pose, the root motion delta and the frame's events all come out of the same pass, because they are three views of the same evaluation and computing them separately would mean evaluating the graph more than once against parameters that a script could change in between.

Nothing here touches an entity. An animator has a skeleton and a pose and no idea what is wearing it — which is what lets a test drive one with a for loop, and what keeps the ECS integration (Vixen.Animation.Ecs) to the thirty lines that copy a root motion delta into a transform.

Fields and properties (13)

  • public Skeleton Skeleton

    The skeleton being posed.

  • public AnimationParameters Parameters

    The values the graphs read. Game code writes these.

  • public SkeletonPose Pose

    The pose as of the last update.

  • public PoseScratch Scratch

    Where blends get their temporary poses.

  • public AnimationEventBuffer Events

    The events the last update produced.

  • public ConstraintTagBuffer Constraints

    The constraints the clips playing this frame carry, and how much of each.

  • public float LastDeltaTime

    How long the last update was, in seconds. Already scaled by Speed.

  • public IReadOnlyList<AnimationLayer> Layers

    The layers, base first.

  • public IList<IPoseProcessor> PoseProcessors

    What runs on the pose after the layers are mixed. IK lives here.

  • public float Speed

    How fast everything plays. One is as authored; zero pauses the character.

  • public RootMotionMode RootMotion

    What to do with the motion baked into the root joint.

  • public int RootJoint

    Which joint carries the character through the world.

  • public RootMotionDelta LastRootMotion

    How far the root moved during the last update.

Methods (5)

  • public Animator(Skeleton skeleton, AnimationParameters? parameters = null)

    Creates an animator for a skeleton.

  • public AnimationLayer AddLayer(string name, AnimationStateMachine machine)

    Adds a layer on top of the ones already there.

  • public AnimationLayer? Layer(string name)

    The layer by name, or .

  • public void Update(float deltaTime)

    Advances every layer and rebuilds the pose.

  • public void ComputeSkinningMatrices(Span<Matrix4x4> destination)

    The bone palette for GPU skinning, as of the last update.

Used by (23)

  • ConstraintStageBenchmarksVixen.Benchmarks.Animation
  • CrowdBenchmarksVixen.Benchmarks.Animation
  • RigsVixen.Benchmarks.Animation
  • AnimationSystemVixen.Animation
  • AnimatorComponentVixen.Animation
  • AnimatorTestsVixen.Animation.Tests
  • ConstraintGizmoSystemVixen.Animation
  • ConstraintStackVixen.Animation
  • ConstraintStageTestsVixen.Animation.Tests
  • ConstraintTestsVixen.Animation.Tests
  • EcsIntegrationTestsVixen.Animation.Tests
  • GizmoTestsVixen.Animation.Tests
  • GroupSinkVixen.Animation
  • IPoseProcessorVixen.Animation
  • NetworkAnimatorApplySystemVixen.Net.Animation
  • NetworkAnimatorCaptureSystemVixen.Net.Animation
  • NetworkAnimatorTestsVixen.Net.Animation.Tests
  • NetworkBonesApplySystemVixen.Net.Animation
  • NetworkBonesCaptureSystemVixen.Net.Animation
  • NetworkBonesTestsVixen.Net.Animation.Tests
  • ReachVixen.Animation.Tests
  • SkinningSystemVixen.Animation
  • UpdateJobVixen.Animation