UGTK / Toolkit / Gameplay Systems / First Person 3D Completed
First Person 3D
Summary
First-person controller for a CharacterController: movement, mouse/stick look and jump driven through the UGTK KeyInputActionSystem, reusing the UGTK movement and jump components.
Content
Modules Dependencies
- UGTK.ComponentModule.MovementComponent —
Mn_CharacterControllerMovementComponentextendsMn_MovementComponent. - UGTK.ComponentModule.JumpComponent —
Mn_CharacterControllerJumpComponentextendsMn_JumpComponent. - UGTK.UtilitySystems.KeyInputActionSystem — input reads (axes, buttons, keys, mouse) go through
KeyInputActionSystem.
Setup
Add a CharacterController and Mn_FirstPersonPlayerController to the player, attach Mn_CharacterControllerMovementComponent and Mn_CharacterControllerJumpComponent (as UGTK component children), set the camera pivot, and make sure a KeyInputActionSystem prefab/system is present in the scene.
How To Use
- Put
Mn_FirstPersonPlayerControlleron a GameObject with aCharacterController;Reset/Awakeauto-wire the movement and jump components and locate aKeyInputActionSystemif none is assigned. - Assign
cameraPivot(child that pitches) and tunemouseSensitivity,joystickLookSensitivity,pitchMin/pitchMax,walkSpeed. - Movement input can come from Input Manager axes (
Horizontal/Vertical) or from UnityEvent hooks (OnMoveForwardPressed/Released, etc.) depending onuseInputManagerAxesForMovement. - Jump can come from the
"Jump"virtual button (useInputManagerVirtualJump) or from theOnJumpPressed()UnityEvent hook. - Look reads
Mouse X/Yplus optionalRightLook X/Ystick axes; on desktop the cursor is locked/hidden (toggle withlockAndHideCursor, released withEscapeorRequestCursorUnlock()). - Ground contact is fed to the jump component via
OnControllerColliderHit+LateUpdate(FeedGroundProbe).
Testing Scene
Open FirstPerson3DTest in the module's Debug/ folder.
What to do, in order:
- Walk with the keys, then look around with the mouse.
- Jump, and jump again the instant you land.
- Walk into a slope and into a step.
- Press RequestCursorUnlock() from the inspector.
Step 4 is the one you will use constantly: a first-person controller locks the pointer, and once locked the inspector is unreachable without stopping the game — so tuning a value means losing the position you were testing from.
The recording is step 1: the mouse turns the view - watch the sun travel across the sky - and W walks forward. The demo scene is a bare floor with nothing on it, so the horizon and the sun are the only landmarks; drop a couple of boxes in before you try steps 2 and 3, or there is nothing to jump onto and no slope to walk into.
Technical Info
- Mn_FirstPersonPlayerController: reads input through
KeyInputActionSystem(withInputfallback), drives look/move/jump, manages cursor lock, and exposes UnityEvent hooks for WASD/jump. - Mn_CharacterControllerMovementComponent:
Mn_MovementComponentvariant that moves viaCharacterController.Move, applies gravity, and accumulates vertical velocity (ApplyJumpImpulseWorld). - Mn_CharacterControllerJumpComponent:
Mn_JumpComponentvariant for a CC without a Rigidbody; applies the jump impulse to the movement component, supports theReachReferencePointforce source, and detects landing viaFeedGroundProbe.
© 2026 Marcello De Bonis. All rights reserved
Used by 0
- No other module depends on it.
Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 10 modules in total.
UGTKengine within an engine

