Skip to main content

Module movement

Module movement 

Source
Expand description

Movement-input helper for the character cameras. Movement-input helper shared across the character camera controllers.

FirstPersonCameraController and ThirdPersonCameraController expose a forward_dir() / right_dir() pair defining the ground-plane basis the player walks in. wish_xy_from_actions resolves the standard fly-movement actions against that basis and returns a normalised horizontal wish vector, so hosts do not reimplement the same movement block per view.

let wish = wish_xy_from_actions(&frame, fps.forward_dir(), fps.right_dir());
let velocity_xy = wish * walk_speed;

Functions§

wish_xy_from_actions
Resolve the forward / back / left / right movement actions into a horizontal wish vector in the camera’s ground-plane basis.