Skip to content

FirstPersonView

namespace Griff.Modules.FirstPerson;
public sealed class FirstPersonView : Component

Shows the game in first person, through the eyes of its Viewer: the level you paint as a top-down map is stood up around the player. Solid tilemaps become walls (textured with their tiles), sprites stand on the floor and always face the player (enemies, pickups, barrels), and Blocks are boxes of wall (doors, pillars). The player’s Weapon is held at the bottom of the screen, under a crosshair. Put it on the camera; the HUD (anything with a ScreenAnchor) still goes on top.

The map is the floor plan: X and Y run across the ground, and the viewer looks the way its Rotation Z points (0 is to the right in the Scene view). One world unit is as tall as WallHeight says, so a 1-unit tile makes a cube of wall. In a dark scene (the camera’s Ambient), Lights light the walls, floor and sprites near them.

This is a component: its saved properties are on its component page.

public float Bob { get; set; }

How much the view (and the weapon) bob as the viewer walks. 0 keeps it steady.

public Color Ceiling { get; set; }

The ceiling’s (or sky’s) color, close up.

public int Columns { get; set; }

How many strips the view is drawn in, across the screen: more is sharper, fewer is chunkier and faster.

public Color Crosshair { get; set; }

The crosshair’s color. Transparent for none.

public float EyeHeight { get; set; }

How high the viewer’s eyes are off the floor, in world units: half the WallHeight looks straight across.

public float FieldOfView { get; set; }

How wide the view is, in degrees across the screen. 60 to 90 suits most games.

public Color Floor { get; set; }

The floor’s color, close up. It fades into Fog in the distance.

public Color Fog { get; set; }

What everything fades into far away: black for a dark dungeon, a haze for outdoors. Transparent for no fog.

public float FogDistance { get; set; }

How far away, in world units, things have faded completely into the Fog.

public Color HurtFlash { get; set; }

The color the screen flashes when the viewer is hurt. Transparent for none.

public bool Minimap { get; set; }

Show a small map of the walls around the viewer in the top-right corner, with enemies and pickups on it.

public bool ShadeSides { get; set; }

Shade walls that face one way darker than those that face the other, so corners read clearly.

public string? Viewer { get; set; }

The name of the entity to look through, e.g. “Player”. Empty looks through the camera’s own entity.

public float WallHeight { get; set; }

How tall walls are, in world units. With 1-unit tiles, 1 makes each a cube.