Vixen
02b45cc4
csharp
public sealed class VirtualCameraSystem

Evaluates every virtual camera: where it would be, where it would look, and how it would shake.

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

As a system

Phase
LateUpdate

Remarks

Which stage a shot uses is an archetype question, not a branch. Each stage is a sweep over the chunks that have that stage's component — the follow bodies are one monomorphic pass over a contiguous column, the composers are another — and a shot with no body at all is matched by a query with WithNone over all four of them and takes its position from its own transform. That is the same shape TransformSystem uses for its roots, and it is the reason this is not a switch over an enum with a union of settings behind it.

The stages are passes inside one system rather than systems of their own. Their order is the design — a body before an aim, because an aim needs somewhere to look from; the confiner and the obstacle avoider between them, because a camera that has been moved must still look at its subject from where it ended up; the shake last, because nothing downstream may damp against it. Expressed as eleven systems with UpdateAfter attributes, that order would be eleven separate things to get wrong, and every one of them would conflict on CameraShot and serialise anyway.

Every shot is evaluated every frame, live or not. Cinemachine makes this a setting per camera and pays for it with shots that lurch when they come on, because their damping is resuming from wherever they were left. A shot is a few dozen floating-point operations and a scene has tens of them; the setting is not worth the class of bug it opens.

It runs in LateUpdate, which is where that phase's own documentation puts "cameras that follow" — after everything has moved, before anything is culled. Targets are read through ResolveWorldMatrix rather than out of WorldTransform, because the transform pass has not run yet this frame and a camera aimed at last frame's position of its subject is a camera that lags by a frame.

Fields and properties (6)

  • public CameraImpulses Impulses

    The impulses every listening shot feels. Aged once a frame by this system.

  • public float AspectRatio

    Width over height of the frame the shots are being composed for.

  • public Vector3 WorldUp

    Which way is up, for every stage that has to keep a horizon level.

  • public ICameraOcclusion? Occlusion

    What answers whether a shot's view of its subject is blocked, or nothing.

  • public ISplineSource? Splines

    Where a TrackedDollyBody's named track is resolved.

  • public SystemAccess Access

Methods (2)

Used by (10)

  • PlayerRigThirdPersonShooter
  • CameraDirectorSystemVixen.Engine
  • CameraDirectorTestsVixen.Engine.Tests
  • PhysicsInterpolationSystemVixen.Physics
  • RigVixen.Engine.Tests
  • RigVixen.Engine.Tests
  • RigVixen.Engine.Tests
  • RigVixen.Engine.Tests
  • TrackedDollyTestsVixen.Engine.Tests
  • VirtualCameraTestsVixen.Engine.Tests