Table of Contents

Class ThirdPersonControl

Third-person character controller with customizable settings via ScriptableObject. Can receive input from ThirdPersonInput or be controlled directly via properties.

public class ThirdPersonControl : MonoBehaviour
Inheritance
ThirdPersonControl

Fields

OnGroundedChanged

public UnityEvent<bool> OnGroundedChanged

Field Value

UnityEvent<bool>

OnJump

public UnityEvent OnJump

Field Value

UnityEvent

OnLand

public UnityEvent OnLand

Field Value

UnityEvent

OnSpeedChanged

public UnityEvent<float> OnSpeedChanged

Field Value

UnityEvent<float>

Properties

Animator

The Animator component (auto-cached from self or children).

public Animator Animator { get; }

Property Value

Animator

CameraTarget

Camera target transform for movement direction reference.

public Transform CameraTarget { get; set; }

Property Value

Transform

CharacterController

The CharacterController component (auto-cached).

public CharacterController CharacterController { get; }

Property Value

CharacterController

Crouch

Crouch input state.

public bool Crouch { get; set; }

Property Value

bool

CrouchSpeed

Gets the effective crouch speed from settings or override.

public float CrouchSpeed { get; }

Property Value

float

CurrentSpeed

Current movement speed.

public float CurrentSpeed { get; }

Property Value

float

Direction

Movement direction input (X = horizontal, Y = vertical).

public Vector2 Direction { get; set; }

Property Value

Vector2

GroundCheckDistance

Gets the effective ground check distance from settings or override.

public float GroundCheckDistance { get; }

Property Value

float

GroundLayers

Gets the effective ground layers from settings or override.

public LayerMask GroundLayers { get; }

Property Value

LayerMask

GroundedGravity

Gets the effective grounded gravity from settings or default.

public float GroundedGravity { get; }

Property Value

float

IsGrounded

Whether the character is currently grounded.

public bool IsGrounded { get; }

Property Value

bool

Jump

Jump input. Set to true to trigger a jump.

public bool Jump { get; set; }

Property Value

bool

JumpForce

Gets the effective jump force from settings or override.

public float JumpForce { get; }

Property Value

float

JumpTimeout

Gets the effective jump timeout from settings or default.

public float JumpTimeout { get; }

Property Value

float

RotationSmoothness

Gets the effective rotation smoothness from settings or override.

public float RotationSmoothness { get; }

Property Value

float

RunSpeed

Gets the effective run speed from settings or override.

public float RunSpeed { get; }

Property Value

float

Settings

The settings ScriptableObject. Can be changed at runtime.

public ThirdPersonSettings Settings { get; set; }

Property Value

ThirdPersonSettings

Sprint

Sprint input state.

public bool Sprint { get; set; }

Property Value

bool

TerminalVelocity

Gets the effective terminal velocity from settings or default.

public float TerminalVelocity { get; }

Property Value

float

VerticalVelocity

Current vertical velocity.

public float VerticalVelocity { get; }

Property Value

float

WalkSpeed

Gets the effective walk speed from settings or override.

public float WalkSpeed { get; }

Property Value

float

Methods

ApplySettings(ThirdPersonSettings)

Apply settings from a ThirdPersonSettings ScriptableObject.

public void ApplySettings(ThirdPersonSettings newSettings)

Parameters

newSettings ThirdPersonSettings

ForceJump()

Force a jump regardless of current state.

public void ForceJump()

ResetVerticalVelocity()

Reset vertical velocity (useful after teleporting).

public void ResetVerticalVelocity()

Teleport(Vector3)

Teleport the character to a position.

public void Teleport(Vector3 position)

Parameters

position Vector3

Teleport(Vector3, Quaternion)

Teleport the character to a position with rotation.

public void Teleport(Vector3 position, Quaternion rotation)

Parameters

position Vector3
rotation Quaternion