menu_bookDocumentation

PlayerController: Physics-Based Character with Events Interface

calendar_today May 20, 2026 schedule ~1 min read person PatrickJr verified 50

The PlayerController component is a physics-based first/third person player controller. Add it to a scene and be running around with no programming required.

Core Features

  • Physics-based: A special RigidBody with velocity, mass, and controllability extras
  • Built-in Input: Owner controls via mouse/keyboard/gamepad. Disable via right-click on the input tab
  • Built-in Camera: Third/first person toggle. Disable via right-click on the camera tab
  • Built-in Animator: Animates Citizen-compatible AnimGraphs. Disable via right-click on the animator tab

Manual Control

If not using built-in input, control in OnFixedUpdate by setting EyeAngles and WishVelocity:

CSHARP
protected override void OnFixedUpdate()
{
    var pc = Components.Get<PlayerController>();
    pc.EyeAngles = new Angles( pitch, yaw, 0 );
    pc.WishVelocity = moveDirection * speed;
}

PlayerController.IEvents

Listen to events by implementing PlayerController.IEvents on a sibling Component:

CSHARP
public class MyPlayerEvents : Component, PlayerController.IEvents
{
    void PlayerController.IEvents.OnEyeAngles( ref Angles angles )
    {
        // Modify sensitivity or stomp input
    }

    void PlayerController.IEvents.PostCameraSetup( CameraComponent cam )
    {
        // Adjust camera after setup
    }

    void PlayerController.IEvents.OnJumped() { }

    void PlayerController.IEvents.OnLanded( float distance, Vector3 impactVelocity )
    {
        // React to landing
    }

    Component PlayerController.IEvents.GetUsableComponent( GameObject go )
    {
        // Return a usable component or null
        return default;
    }

    void PlayerController.IEvents.StartPressing( Component target ) { }
    void PlayerController.IEvents.StopPressing( Component target ) { }
    void PlayerController.IEvents.FailPressing() { }
}
Was this helpful?