Vixen
02b45cc4
csharp
public struct FramingBody

Keeps the target at a chosen place on the screen, at a chosen distance, and does nothing at all while it is already close enough to it.

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

Remarks

Cinemachine's Framing Transposer, and the body a third-person or 2D-follow camera usually wants. It differs from FollowBody in the thing it is trying to hold constant: not a position in the world, but a position in the frame. The camera moves only enough to bring the target back inside DeadZone, which is what stops a follow camera from twitching at every small movement of a character who is essentially standing still.

⚠ It frames using the rotation the shot had at the end of the previous frame, because the aim stage that decides this frame's rotation has not run yet — the body stage is what feeds it a position. Cinemachine has the same one-frame relationship and for the same reason. It is invisible while the camera is turning at any sane rate, and the alternative is a fixed point iteration between the two stages every frame.

Fields and properties (7)

  • public Vector3 TrackedOffset

    An offset added to the target's position before framing, in world space.

  • public float Distance

    How far from the target the camera tries to sit.

  • public Vector2 ScreenPosition

    Where in the frame the target belongs, in normalised device coordinates.

  • public Vector2 DeadZone

    How far from ScreenPosition the target may drift before the camera reacts, as a half-extent in the same normalised coordinates.

  • public float MinimumDistance

    The closest the camera may come to the target. Zero for no limit.

  • public float MaximumDistance

    The furthest the camera may be from the target. Zero for no limit.

  • public Vector3 Damping

    Damping in camera space: X across the frame, Y up it, Z along the view axis.

Methods (1)

  • public static FramingBody At(float distance, float damping = 0.5)

    A camera framing its target dead centre at a distance, with a tenth-screen dead zone.

Used by (8)

  • CameraDirectorTestsVixen.Engine.Tests
  • ComponentRegistrationVixen.Engine
  • TypeRegistrationVixen.Engine
  • VirtualCameraSystemVixen.Engine
  • VirtualCameraTestsVixen.Engine.Tests
  • VirtualCamerasVixen.Engine
  • Vixen_Engine_Cameras_FramingBodySerializerVixen.Engine
  • MaterialIconsVixen.Editor.App