Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
Game mechanicsNovember 22, 20266 min read

A First-Person Controller for Browser Games

In first person, the controller is the player's body and the camera is their eyes. Every value is felt directly, so small mistakes feel big.

Startbase Team
Editorial ink illustration of brass binoculars on a stone windowsill overlooking hills, the left binocular lens in ember orange

Key takeaways

  • Use pointer lock on desktop, apply raw mouse movement with no smoothing, and treat losing the lock as pause.
  • Start at eye height 1.6 m, a vertical field of view around 70 degrees, walk about 4 m/s and sprint 6 to 7 m/s.
  • Comfort is part of the controller: field of view and sensitivity settings, head bob off by default, and no sudden camera moves.

A first-person controller puts the camera at the player's eyes: the mouse or a drag turns the view, keys or a stick move the body, and the world is seen without a character on screen. In a browser game it is built from the Pointer Lock API for mouse look, a camera that yaws the body and pitches the head, a collision capsule that walks over steps and slopes, and a short list of comfort settings. Three.js provides the camera and Rapier the physics; the values below make it feel like a real game rather than a tech demo.

Mouse look and pointer lock

A first-person game needs the mouse to turn the view without a cursor hitting the screen edge. Browsers provide this through pointer lock: after the player clicks, the cursor disappears and the game receives raw movement amounts. A few rules make it reliable:

  • Request the lock from a click, like a Play button or a click on the game. Browsers do not allow it without a user gesture.
  • Escape releases the lock, always; you cannot prevent it. Treat losing the lock as pausing: show the pause menu and require a click to resume.
  • Apply movement directly. Each mouse movement event adds `movementX × sensitivity` to yaw and `movementY × sensitivity` to pitch. No smoothing by default: smoothing adds lag that players feel as heaviness.
  • Ignore spikes. Some browsers occasionally report a very large movement in one event (often right after the lock starts). Discard single events far above normal, such as several hundred pixels.
  • Sensitivity: around 0.002 radians per pixel is a reasonable default, with a slider from about a quarter to four times that, and an invert Y option.

Yaw on the body, pitch on the head

Split rotation in two. The body turns left and right (yaw), and the head (the camera) tilts up and down (pitch) as a child of the body. Movement uses only the body's yaw, so looking at the floor does not slow you down or push you into the ground.

  • Clamp pitch to just under plus and minus 90 degrees (about 89). At exactly 90 the view flips.
  • Do not clamp yaw; let it grow and wrap it to a full circle if you store it.
  • If you rotate one object for both, set its rotation order so yaw applies before pitch (in Three.js, an Euler order of `YXZ`). The default order produces a rolling, tilted horizon when you look around.

Camera values

  • Eye height: about 1.6 to 1.7 m above the floor for an adult character. Lower (1.2 m) makes the world feel big; higher feels like stilts.
  • Field of view: Three.js sets the vertical angle. Around 70 degrees vertical is a comfortable default on a 16:9 screen (roughly 100 degrees horizontal). Offer a slider from about 60 to 90. Narrow fields of view are a common cause of motion sickness on large screens.
  • Near plane about 0.05 to 0.1 m, so walls do not cut through the view when the player presses against them.
  • Crouch lowers the eye to about 1.0 to 1.2 m over 0.1 to 0.15 seconds, smoothly.
  • Speed field of view: widen the view by 3 to 5 degrees while sprinting for a sense of speed. Never more than that, and off when reduced motion is on.

Movement values

First-person games usually move faster than real people walk, because the world feels slow through a screen. Starting values:

  • Walk about 4 m/s, sprint 6 to 7 m/s, crouch about 2 m/s. Exploration and horror games sit lower (walk around 2.5 to 3); arena shooters sit much higher.
  • Ground acceleration: reach top speed in about 0.1 seconds. Stopping in under 0.1 seconds. First person magnifies any slide.
  • Air control of 20 to 40 percent of ground acceleration.
  • Jump height about 1 to 1.2 m, enough to climb a crate, not a wall.
  • Normalize diagonals, so W plus D is not 41 percent faster than W.
  • Capsule: radius 0.3 to 0.4 m, height 1.7 to 1.8 m, with a step height of 0.3 to 0.4 m and a maximum climbable slope around 45 degrees. Rapier's kinematic character controller has settings for steps, slopes and snapping to the ground.

Tip

Ask for sensitivity, field of view, speeds and acceleration as dials. In Startbase they then appear in the Engine panel, and you can tune feel while walking around instead of guessing in code.

Looking at things: the center ray

Most first-person games interact through the center of the screen. Each frame (or a few times a second), cast a ray from the camera straight forward, about 2 to 3 meters for using objects. If it hits something interactive, highlight it (an outline or a brighter tint) and show a short prompt near the crosshair ("E Open" or a tap icon). Keep a small dot or crosshair in the middle of the screen: without it, players cannot tell exactly what they are pointing at, and some players get motion sick without a fixed point of reference.

First person on phones

Pointer lock does not exist on touch screens, so look is a drag. Split the screen: a floating virtual stick on the left half for movement, and the right half as a look pad where dragging turns the view. Use a separate touch sensitivity (often around 0.004 to 0.006 radians per point), and add buttons for jump and interact under the right thumb. Tapping on an interactive object to use it, instead of aiming at it, makes exploration games much friendlier on phones. Our touch controls guide covers thumb zones and sizes.

Comfort is part of the controller

First-person views cause motion sickness in some players more than any other camera. You cannot remove it entirely, but you can avoid making it worse:

  • Head bob off by default, or very small (a few centimeters) with a setting. Strong bob is the most common complaint.
  • No camera moves the player did not cause: no forced turns, no long cinematic sweeps from the player's eyes, short and small shake only.
  • Field of view and sensitivity settings, plus reduced motion that disables sprint field of view changes and shake.
  • Steady frame rate matters more than detail; a dropped frame is felt in first person. Our phone performance guide covers the budget.

The accessibility guide covers motion settings and why they matter for more players than you might expect.

Bugs first-person controllers usually have

  • Walking up walls: slopes treated as floors because the maximum slope is not set. Steep surfaces must block or slide.
  • Stuck on small edges: step height too low, or a box collider instead of a capsule catching on tile seams.
  • Sliding down gentle slopes when standing still: apply ground snap and zero horizontal velocity when there is no input.
  • Held items clip into walls: draw hands or tools with a second camera (or a separate render pass after the world, with the depth cleared) so they always appear in front.
  • Lock lost silently: the tab lost focus and the game kept running with a frozen view. Listen for the pointer lock change event and pause.
  • Frame rate dependent look: mouse movement is already a distance, so never multiply it by frame time. Stick and keyboard turning, by contrast, must be multiplied by frame time.

A brief for a first-person controller

Build a first-person controller for my 3D exploration game with Three.js and Rapier's kinematic character controller. Pointer lock starts from the Play button; losing it opens the pause menu. Mouse look is raw, 0.002 rad per pixel with a sensitivity slider and invert Y, ignoring single spikes; yaw on the body, pitch on the camera clamped to 89 degrees. Eye height 1.65 m, vertical field of view 70 with a 60 to 90 slider, near plane 0.05. Walk 3.5 m/s, sprint 6, crouch 2 (eye at 1.1 m), reach speed in 0.1 s, 30 percent air control, jump 1.1 m, diagonals normalized. Capsule radius 0.35, height 1.8, step 0.35, max slope 45 degrees, snap to ground. Center ray of 2.5 m highlights usable objects with a prompt; small center dot. On touch: left stick, right-half drag to look, tap objects to use. No head bob. Make every value an Engine panel dial.

First person suits exploration, puzzle rooms and horror particularly well in the browser; our horror game guide covers how to pace tension around a controller like this one, and the games docs describe the 3D setup Startbase games start from.

Frequently asked questions

How do I make mouse look work in a browser game?

Use the Pointer Lock API: request the lock from a click, read each mouse event's movement values, and add them to yaw and pitch multiplied by a sensitivity. Treat losing the lock, for example on Escape, as a pause.

What field of view should a first-person game use?

Around 70 degrees vertical (about 100 horizontal on a widescreen) is a comfortable default. Offer a slider from about 60 to 90, since narrow views make some players motion sick.

How fast should a first-person character move?

A walk of about 4 meters per second and a sprint of 6 to 7 is a good starting point for most games. Slow exploration and horror games walk nearer 2.5 to 3; fast arena shooters go much higher.

Can a first-person game work on phones?

Yes, with a different control scheme: a virtual stick for movement, a drag on the right half of the screen to look, buttons under the right thumb, and tapping objects to use them.

On this page

  • Mouse look and pointer lock
  • Yaw on the body, pitch on the head
  • Camera values
  • Movement values
  • Looking at things: the center ray
  • First person on phones
  • Comfort is part of the controller
  • Bugs first-person controllers usually have
  • A brief for a first-person controller

Keep reading

More in Game mechanics
Editorial ink illustration of a wooden toy figure in mid-air above a gap, the puff cloud under its feet in ember orange
Game mechanicsNovember 22, 2026

How to Add a Double Jump to Your Game

A double jump is one counter and one reset rule, but the details decide whether it feels like control or like cheating. Here are the values and the bugs to watch for.

8 min read
Editorial ink illustration of a small figure streaking along a stone floor with faded ghost copies behind it, the front figure's scarf in ember orange
Game mechanicsNovember 22, 2026

How to Add a Dash Move

A dash is a short burst of fixed speed that overrides normal movement. Get its distance, its ending and its refill rule right and it becomes the move players use most.

7 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.