Player Movement, Camera & Controls

How the local player moves, dodges, and sees the world. Movement is Rigidbody-driven and networked; the camera is a client-only WoW/Smite-style orbit rig; and the multi-zone world adds one hard rule โ€” exactly one live camera, always.

โ„น๏ธ These scripts live under a legacy path

PlayerMovement.cs and CameraFollow.cs sit in Assets/Game/Characters/Engineer/Scripts/ โ€” a relic of when class 0 was called Engineer (โ†’ Warden โ†’ Marauder). They are the shared player movement/camera used by every hero, not Engineer-only code. The folder name is history, not scope. See Canonical Facts & Doc Divergences.

Movement โ€” PlayerMovement (NetworkBehaviour)

Rigidbody-driven locomotion via MovePosition, gated to the local player (isLocalPlayer).

FieldDefaultMeaning
moveSpeed / sprintSpeed5 / 9Walk vs. sprint
jumpForce6Jump impulse
rotationSpeed12Turn rate toward move/aim direction
keepUprighttrueLocks the body upright (no tipping on slopes)
lockCharacterRotationfalseOptionally pin facing (used during aim; can capture start rotation)
useBackwardMovementAnimationtruePlays a back-step anim when moving backward
movementLockedfalseHard stop (cutscenes/casting)
๐Ÿ›‘ The root-motion fly bug is fixed here

PlayerMovement.Start sets anim.applyRootMotion = false. If an imported rig ships with Apply Root Motion on, the Animator drives the root while the Rigidbody drags it via MovePosition โ€” the mesh detaches and "flies wild in POV." This is not a camera bug. See Known Issues & Tech Debt.

Dodge roll

A built-in dodge (distinct from class ability dashes like DashHandler):

  • dodgeForce 14, dodgeDuration 0.35s (i-frames + movement burst)
  • dodgeMaxCharges 2, dodgeRecharge 5s per charge, optional dodgeVFX
  • Surfaced on the HUD as dodge pips (filled = ready). See UI & HUD Systems.

Camera โ€” CameraFollow (client-only)

A WoW/Smite-style third-person orbit rig. Cursor is free by default; hold right mouse to orbit (yaw + pitch), cursor locked only during the drag.

FieldDefaultMeaning
distance (CameraZoomDistance pref)7Zoom distance, persisted between sessions
minDistance / maxDistance1.5 / 20Scroll-wheel zoom range
mouseSensitivity0.25Orbit speed
minPitch / maxPitchโˆ’20 / 70Vertical clamp
heightOffset1.6Look-at height on the target
cameraCollision (+ radius/buffer/smooth)on, 0.28Sphere-cast pull-in so the camera doesn't clip through geometry

Design notes baked into the code:

  • Position follows instantly (smoothing caused drift); the first-frame mouse delta is discarded to avoid a violent swing on the first orbit.
  • A _typingInUI flag suppresses orbit while typing in chat/console, so WASD/mouse in a text field doesn't spin the camera. See UI & HUD Systems.
  • The camera is wired in OnStartLocalPlayer (not on spawn), which fixed the "camera never attaches" bug on non-host clients.

The multi-zone camera rule โ€” ZoneCameraDirector

Additive multi-zone loading (Zones, Scenes & Multi-Zone) means several scenes โ€” each potentially with its own camera โ€” are loaded at once. That broke movement in a subtle way:

โš ๏ธ "Movement is a mix of WASD" = wrong camera bound

WASD is camera-relative. If the controller binds to another zone's camera, your input is rotated by however that camera faces. ZoneCameraDirector enforces exactly one enabled camera in the container at all times (Camera.allCameras only returns enabled cameras), and applies the active zone's skybox/fog to that shared camera. This is ROADMAP 6.9, and the reason the approach changed mid-development. See Zones, Scenes & Multi-Zone.

  • DashHandler, StealthHandler, SiegeModeHandler, IronTetherHandler, KineticReversalHandler, TransferProtocolHandler (Player/Scripts/) โ€” these are class-ability movement/state handlers, not general locomotion. See Ability Atlas & Synergies ยท Heroes & Classes.
  • PlayerFallReset โ€” recovers a player who falls out of the world.
  • Mount (MotorcycleController, Founder Bike) โ€” separate rideable traversal. See Mounts & Traversal.

How it developed

Movement/camera were among the most-iterated systems: the camera went from a basic follow to Smite-style right-mouse-drag orbit (2026-07-05), then a run of fixes for camera collision, attach-on-OnStartLocalPlayer, and aim drift (the character faces the cursor while aiming, without the camera fighting the cursor lock). Movement got slope/incline rotation cleanup, root motion removed from mobs and players, and finally the one-camera-per-zone director when the world went multi-zone. See Development History & Timeline.


Related: UI & HUD Systems ยท Zones, Scenes & Multi-Zone ยท Heroes & Classes ยท Mounts & Traversal