DO NOT USE IN COMERCIAL PROJECTS without permisions
Third-Person-Controller is rigidbody character controller with statemachine based logic and custom Dependency Injection
| Supported state machines | |
|---|---|
| Code State Machine | ✔️ |
| Visual scripting state machine | ✔️ |
| Current States | |
|---|---|
| Idle | ✔️ |
| Walk | ✔️ |
| Run | ✔️ |
| Sprint | ✔️ |
| Jump | ✔️ |
| Crouch | ✔️ |
| Prone | ✔️ |
| In Air | ✔️ |
using ThirdPersonController.Core.DI;
using ThirdPersonController.Core;
using UnityEngine;
public class ExampleFeature : BaseFeature
{
[SerializeField] private float gravityValue = -10;
private Rigidbody _rigidbody;
public override void CacheReferences(IStateMachineVariables variables, IReferenceResolver resolver)
{
_rigidbody = resolver.GetComponent<Rigidbody>();
}
public override void OnEnterState() => Debug.Log("OnEnterState");
public override void OnUpdateState() => Debug.Log("OnUpdateState");
public override void OnFixedUpdateState() => _rigidbody.AddForce(Vector3.up * gravityValue, ForceMode.VelocityChange);
public override void OnExitState() => Debug.Log("OnExitState");
}using System;
using ThirdPersonController.Core.DI;
using ThirdPersonController.Core.CodeStateMachine;
public class GroundedStateTransition : BaseStateTransition
{
public bool shouldBeGrounded;
private IMoveStateMachineVariables _variables;
public override void Initialise(IStateMachineVariables variables,IReferenceResolver resolver)
{
_variables = variables as IMoveStateMachineVariables;
}
public override bool couldHaveTransition => _variables.IsGrounded == shouldBeGrounded;
}Known issues:
FootStep Feature lagging and code refactor





