Vixen
dd8b0a81
csharp
public static class PlayerCameras

The camera rigs that need to know where a player is looking.

Read the guide page for this →

Remarks

Why these are in the engine when a tuned rig belongs in a sample. [29](../../../docs/plan/29-players-and-possession.md) is firm that the engine ships mechanism rather than a ruleset, and a camera preset would be a ruleset. These are not presets: a first-person camera and a third-person orbit are the two rigs that cannot be assembled from outside this assembly, because both are steered by ControlRotation and the write that carries it into PovAim and OrbitBody is PossessionSystem's. Everything a game would actually tune — the distance, the height, the damping, the lens — is an argument here and a component afterwards.

Both build on doc 26's stages and add nothing to them. A game that wants a different rig writes the same three component adds with different values, which is what the source of each of these is.

Fields and properties (1)

  • public const int MaxSeats

    How many seats a split screen holds.

Methods (5)

  • public static PlayerCamera FirstPerson(World world, Entity controller, float eyeHeight = 1.65)

    A camera at the player's eyes, looking exactly where they are aiming.

  • public static PlayerCamera ThirdPerson(World world, Entity controller, float distance = 4, float shoulderHeight = 1.4, float damping = 0.3)

    A camera orbiting behind the player, at the angle they are aiming.

  • public static Entity CreateEye(World world, int channel = 0)

    The real camera and its director, on a player's own channel.

  • public static Rectangle SeatRect(int seat, int seats)

    The part of the screen one seat of a split screen owns, as fractions of it.

  • public static void SplitScreen(World world, ReadOnlySpan<Entity> eyes)

    Gives each camera its own part of the screen, in the order they are listed.

Used by (3)

  • PlayerRigThirdPersonShooter
  • PlayerCameraTestsVixen.Engine.Tests
  • SplitScreenExtractionTestsVixen.Rendering.Tests