← Back to Docs
  • index.html
  • Clayground
  • Clayground.Character3D
  • CharacterController
  • Clayground 2025.2
  • CharacterController QML Type

    Player input controller for Character movement. More...

    Import Statement: import Clayground.Character3D

    Properties

    Signals

    Detailed Description

    CharacterController translates input axis values into character movement and rotation. Bind axisX and axisY to a GameController or other input source to control a character.

    The controller automatically sets the character's activity state based on movement (Idle, Walking, Running).

    Example usage:

    import Clayground.Character3D
    import Clayground.GameController
    
    Character {
        id: hero
    }
    
    GameController {
        id: gamepad
    }
    
    CharacterController {
        character: hero
        axisX: gamepad.axisLeftX
        axisY: gamepad.axisLeftY
        sprinting: gamepad.buttonL1
    }

    See also Character and PatrolController.

    Property Documentation

    axisX : real [required]

    Horizontal input axis for turning (-1 to 1, required).


    axisY : real [required]

    Vertical input axis for forward/backward (-1 to 1, required).


    character : QtObject [required]

    The character to control (required).


    enabled : bool

    Whether the controller is active.


    inputDeadzone : real

    Axis values below this threshold are treated as zero.


    isMoving : bool [read-only]

    True when forward/backward input is active.


    isTurning : bool [read-only]

    True when turn input is active.


    processedAxisX : real [read-only]

    Horizontal axis value after deadzone is applied.


    processedAxisY : real [read-only]

    Vertical axis value after deadzone is applied.


    sprinting : bool

    When true, character runs instead of walks.


    turnSpeed : real

    Turn speed in degrees per frame per unit axis input.


    updateInterval : int

    Update frequency in milliseconds.


    Signal Documentation

    moved(real deltaX, real deltaZ)

    Emitted when the character moves.

    Note: The corresponding handler is onMoved.


    turned(real deltaYaw)

    Emitted when the character turns.

    Note: The corresponding handler is onTurned.