FirstPersonView
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.
Part of the First Person module: First-person games: the world seen through the player’s eyes from a flat map (FirstPersonView), walking and turning (FirstPersonMovement), weapons, billboards and solid blocks, and the Shooter template.
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.
Requires: Camera
Works with: FirstPersonMovement (on the viewer: walk, strafe and turn); Weapon (on the viewer: shown in hand)
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
viewer: text = “Player”. The name of the entity to look through, e.g. “Player”. Empty looks through the camera’s own entity. (Names an entity.) (Field: an entity’s name.)fieldOfView: a number = 70. How wide the view is, in degrees across the screen. 60 to 90 suits most games. (Field: a number.)
wallHeight: a number = 1. How tall walls are, in world units. With 1-unit tiles, 1 makes each a cube. (Field: a number.)eyeHeight: a number = 0.5. How high the viewer’s eyes are off the floor, in world units: half the WallHeight looks straight across. (Field: a number.)columns: a whole number = 360. How many strips the view is drawn in, across the screen: more is sharper, fewer is chunkier and faster. (Field: a number.)
Colors and Fog
Section titled “Colors and Fog”floor: a color, “#RRGGBB” or “#RRGGBBAA” = “#3A3430FF”. The floor’s color, close up. It fades into Fog in the distance. (Field: a color.)ceiling: a color, “#RRGGBB” or “#RRGGBBAA” = “#242730FF”. The ceiling’s (or sky’s) color, close up. (Field: a color.)fog: a color, “#RRGGBB” or “#RRGGBBAA” = “#101116FF”. What everything fades into far away: black for a dark dungeon, a haze for outdoors. Transparent for no fog. (Field: a color.)fogDistance: a number = 16. How far away, in world units, things have faded completely into the Fog. (Field: a number.)shadeSides: true or false = true. Shade walls that face one way darker than those that face the other, so corners read clearly. (Field: on or off.)
Screen
Section titled “Screen”bob: a number = 1. How much the view (and the weapon) bob as the viewer walks. 0 keeps it steady. (Field: a number.)crosshair: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFCC”. The crosshair’s color. Transparent for none. (Field: a color.)minimap: true or false = true. Show a small map of the walls around the viewer in the top-right corner, with enemies and pickups on it. (Field: on or off.)hurtFlash: a color, “#RRGGBB” or “#RRGGBBAA” = “#D91A1A73”. The color the screen flashes when the viewer is hurt. Transparent for none. (Field: a color.)
Scripts use it as FirstPersonView: its methods, events and values that aren’t saved with the scene.