Log inGet started
World

Controllers

README.md

Controllers

The controllers a game moves its player, its vehicles and its cameras with, as three packages a world installs together:

PackageWhat it holds
characterControllerCharacterController, the kinematic walk, run and jump mover for a character (capsule casts, slopes, steps, moving platforms, carrying, pushing, swimming); MovementState, the motion its animation reads; Locomotion and LocomotionFull, the blend-space animation layers; the Synty Polygon Masculine clip library with its presets (synty, synty_full, humanoid) and the feel presets (floaty, instant, responsive, weighty); WASDInput, which drives a controller from the keyboard; AnimDebug; the flight input map; the characterController install toolbox.
cameraRigsThe camera behaviors a Camera runs: orbital_follow and third_person_follow (follow a player), first_person, chase and mount (ride a vehicle or a body), rts, isometric, birds_eye, orbit (look over a scene), side_scroller, cinematic and menu; camera_rig, the follow internals they share; the cameraRig input map.
vehicleControllerVehicleController, the arcade-to-sim car driver over WheelColliders (assists, recovery, a zoom hand-off to the chase camera); vehicleIntent, the driving intent it reads; the vehicle input map.

Installing

Install the world once as a library; every package in it comes with it:

world.installLibrary({ world = "034d26cf-dc3d-4123-abad-3944f97c6a60", as = "controllers" })

Every asset is then named @controllers::<package>.<name>, which is the name this world gives it with @controllers:: in front: this world's characterController.CharacterController is the installing world's @controllers:: + characterController.CharacterController. asset.list("component") lists each one under the installing world's name. The examples on these pages are written as this world names them; in another world write @controllers:: in front of each package name:

local body = entity.spawn("hero")
body.component.add("Asset", { source = asset.resolve("@builtin::avatars.humanoid", "avatar") })
body.component.add("characterController.CharacterController", {})
body.component.add("characterController.MovementState", {})

local cam = entity.spawn("cam")
cam.component.add("Camera", { behavior = asset.ref("cameraRigs.orbital_follow", "component") })

CharacterController and orbital_follow carry the playerDefault tag, so once the library is installed the scene.player tool set to "spawns" and the player scene template author a player who walks with them, and CharacterController and VehicleController carry bodyMover, so Physics.setVelocity and Physics.moverOf reach them.

Guides

  • characterController/documentation/01-overview to 05-launch-and-knockback: the character controller, installing it, presets, customizing, launches and knockback.
  • cameraRigs/documentation/choosing-a-camera: which camera behavior fits which game, and the fields each one reads.
  • vehicleController/documentation/driving: a drivable car from WheelColliders, the controls, and a chase camera behind it.

Tests

Each package carries a suite under its tests/ folder: controllers_character, controllers_cameras and controllers_vehicle. They run in an engine bound to this world, or to a world that installs it: tools.use("tests", "run", { suite = "controllers_character" }), or luau_test { instance } against that engine.