FirstPersonView
namespace Griff.Modules.FirstPerson;
public sealed class FirstPersonView : ComponentShows 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.
Properties
Section titled “Properties”public float Bob { get; set; }How much the view (and the weapon) bob as the viewer walks. 0 keeps it steady.
Ceiling
Section titled “Ceiling”public Color Ceiling { get; set; }The ceiling’s (or sky’s) color, close up.
Columns
Section titled “Columns”public int Columns { get; set; }How many strips the view is drawn in, across the screen: more is sharper, fewer is chunkier and faster.
Crosshair
Section titled “Crosshair”public Color Crosshair { get; set; }The crosshair’s color. Transparent for none.
EyeHeight
Section titled “EyeHeight”public float EyeHeight { get; set; }How high the viewer’s eyes are off the floor, in world units: half the WallHeight looks straight across.
FieldOfView
Section titled “FieldOfView”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.
FogDistance
Section titled “FogDistance”public float FogDistance { get; set; }How far away, in world units, things have faded completely into the Fog.
HurtFlash
Section titled “HurtFlash”public Color HurtFlash { get; set; }The color the screen flashes when the viewer is hurt. Transparent for none.
Minimap
Section titled “Minimap”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.
ShadeSides
Section titled “ShadeSides”public bool ShadeSides { get; set; }Shade walls that face one way darker than those that face the other, so corners read clearly.
Viewer
Section titled “Viewer”public string? Viewer { get; set; }The name of the entity to look through, e.g. “Player”. Empty looks through the camera’s own entity.
WallHeight
Section titled “WallHeight”public float WallHeight { get; set; }How tall walls are, in world units. With 1-unit tiles, 1 makes each a cube.