Documentation / Runtime API

Interfaces

The public runtime API for integrating with the controller. All runtime types are in namespace Player. This page covers the integration surface: demo scripts, editor inspectors, and internal tuning fields are omitted (see source under Assets/FBSystem/).

vedaloiv / shipped sourcev1.1.0namespace Player
Easy FP Full Body Controller integrations in Unity
Integration surfaceRuntime API

PlayerController: the hub

Central MonoBehaviour. Auto-finds every sub-component in Awake if you leave them unassigned, so external code only needs one reference.

Subsystem accessors

PropertyTypeSubsystem
SettingsPlayerSettingsglobal config asset
InputPlayerInputHandlerinput state
LocomotionPlayerLocomotionmovement & physics
CameraControllerPlayerCameraControllerFPS camera
AnimatorControllerPlayerAnimatorControlleranimation + item layers
HeadIKPlayerHeadIKhead look-at IK
HandIKPlayerHandIKhand IK
SpineStabilizerPlayerSpineStabilizerspine yaw
HandItemSocketHandItemSocketitem equip

State (read-only)

MemberTypeNotes
IsGroundedread-only state
IsSprintingread-only state
MoveInputread-only state
LookInputread-only state
FlashlightTriggeredread-only state
CurrentSpeedread-only state
MaxSpeedread-only state

Control methods (menus / cutscenes / pausing):

MemberSignatureNotes
SetInputEnabledSetInputEnabled(bool)
SetMovementEnabledSetMovementEnabled(bool)
SetCameraEnabledSetCameraEnabled(bool)
SetHeadIKEnabledSetHeadIKEnabled(bool)
SetHandIKEnabledSetHandIKEnabled(bool)
SetSpineStabilizationEnabledSetSpineStabilizationEnabled(bool)
SetCursorLockedSetCursorLocked(bool)
EnableAllControlsEnableAllControls()resume gameplay
DisableAllControlsDisableAllControls()enter cutscene / menu
var player = GetComponent<PlayerController>();
player.DisableAllControls();   // enter cutscene / menu
// ...
player.EnableAllControls();    // resume gameplay

Configuration: PlayerSettings

ScriptableObject (Create ▸ Player ▸ Settings). Referenced by most components, so it's the single place to tune feel. beginnerMode toggles a simplified inspector view.

MemberTypeNotes
beginnerModeboolWhen enabled, the Inspector will show a simplified view for beginners. (default: true)
walkSpeedfloatWalking speed in units per second. (default: 3.0f)
sprintSpeedfloatSprinting speed in units per second. (default: 6.0f)
crouchSpeedfloatMovement speed while crouching in units per second. (default: 1.5f)
crouchHeightfloatCharacterController height while crouching. (default: 1.0f)
standHeightfloatCharacterController height while standing. (default: 2.0f)
crouchTransitionSpeedfloatSpeed of crouch/stand transition. (default: 8f)
jumpHeightfloatJump height in units. (default: 1.2f)
gravityfloatGravity force (should be negative). (default: -15f)
groundCheckDistancefloatDistance to check for ground below player. (default: 0.2f)
groundedVelocityResetfloatVelocity applied when grounded to keep player grounded. (default: -2f)
inputDeadzonefloatMinimum input magnitude to register movement. (default: 0.01f)
animationSmoothTimefloatTime to smooth animation parameter changes. (default: 0.1f)
sprintAnimMultiplierfloatAnimation speed multiplier when sprinting. (default: 1.5f)
defaultHeadHeightfloatDefault head height when no head bone is available. (default: 1.6f)
lookTargetDistancefloatDistance to place look target in front of player. (default: 2f)
cameraFallbackHeadHeightfloatFallback head height when head bone is not assigned. (default: 1.7f)
verticalLookLimitfloatMaximum vertical look angle for the camera. (default: 80f)
handVerticalLimitUpper/LowerfloatMaximum vertical look angle for the hand IK tracking when looking UP; Maximum vertical look angle for the hand IK tracking when looking DOWN. (default: 45f / 45f)
enableSpineStabilizationboolEnable spine stabilization logic. (default: true)
spineStiffnessfloatWeight of stabilization. (default: 1.0f)
spineDampingfloatSmoothing speed. (default: 10f)
lowerSpineWeightfloatRotation weight for lower spine. (default: 0.3f)
middleSpineWeightfloatRotation weight for middle spine. (default: 0.3f)
upperSpineWeightfloatRotation weight for upper spine. (default: 0.4f)

Input: PlayerInputHandler

Reads the Unity Input System asset (inputActions, actionMapName = "Player").

Per-frame state (read-only)

MemberTypeNotes
MoveInputVector2Current movement input vector (X = Strafe, Y = Forward), normalized between -1 and 1.
LookInputVector2Current look input vector (X = Horizontal, Y = Vertical) from mouse/joystick.
IsSprintingboolWhether the sprint button is currently held.
JumpTriggeredboolWhether a jump was triggered this frame; true for the single frame jump is pressed.
IsCrouchingboolWhether the player is in the crouch state (toggled on each press).
FlashlightTriggeredboolWhether the flashlight was toggled this frame; true for the single frame it is pressed.

Methods

MemberSignatureNotes
LockCursorLockCursor()Locks the cursor for first-person gameplay (sets Cursor.lockState to Locked, hides cursor).
UnlockCursorUnlockCursor()Unlocks the cursor for UI interaction (sets Cursor.lockState to None, shows cursor).

Player action map (FBInputActions)

  • Move
  • Look
  • Attack
  • Interact
  • Crouch
  • Jump
  • Previous
  • Next
  • Sprint
  • Flashlight

Locomotion: PlayerLocomotion

[RequireComponent(typeof(CharacterController))].

Configurable fields

MemberTypeNotes
walkSpeedfloatHorizontal movement speed while walking. (default: 3.0f)
sprintSpeedfloatHorizontal movement speed while sprinting. (default: 6.0f)
jumpHeightfloatVertical height of a single jump. (default: 1.2f)
gravityfloatGravity force applied to the player (negative value). (default: -15f)
crouchSpeedfloatHorizontal movement speed while crouching. (default: 1.5f)
crouchHeightfloatCharacterController height when fully crouched. (default: 1.0f)
standHeightfloatCharacterController height when standing. (default: 2.0f)
crouchTransitionSpeedfloatSpeed of height interpolation between states. (default: 8f)
groundCheckDistancefloatDistance below feet to check for ground. (default: 0.2f)
groundLayersLayerMaskLayers to consider as ground. (default: ~0)
inputDeadzonefloatMinimum input magnitude to trigger movement. (default: 0.01f)

State

MemberTypeNotes
IsGroundedboolTrue if the player is currently touching the ground (CharacterController + raycast fallback).
IsSprintingboolTrue if the player is currently sprinting; only possible when grounded and not crouching.
CurrentSpeedfloatThe current horizontal speed of the player in units per second.
MaxSpeedfloatThe theoretical maximum speed in the current state (crouch/walk/sprint).

Fires the locomotion events listed below.

Camera: PlayerCameraController

Cinemachine-based.

Configurable

MemberTypeNotes
eyeOffsetVector3Offset from head bone position while standing. (default: (0, 0.05, 0.1))
crouchEyeOffsetVector3Offset from head bone position while crouching. (default: (0, 0.05, 0.05))
lookSensitivityfloatMouse sensitivity multiplier. (default: 0.1f)
verticalLookLimitfloatMaximum vertical look angle (degrees). (default: 80f)

Public API

MemberType / SignatureNotes
CameraTargetTransformThe actual transform the Cinemachine camera follows and looks at.
PitchfloatCurrent vertical look angle in degrees (used by Animation Rigging).
YawfloatCurrent horizontal look angle in degrees.
GetLookAnglesGetLookAngles() → Vector2Gets the current look direction as a Vector2 (X = Yaw, Y = Pitch).
SetLookDirectionSetLookDirection(float yaw, float pitch)Sets the look direction programmatically (useful for respawning, cutscenes, etc.).
SyncCameraTargetToHeadSyncCameraTargetToHead()Syncs the camera target position to the animated head bone; called in LateUpdate; external IK systems may call it manually.
SetVerticalLimitOverrideSetVerticalLimitOverride(float upper, float lower)Sets the vertical limit override for asymmetric look limits (used by item IK data).

Items

HandItemSocket: canonical equip event source

The single owner of equip/unequip events.

Properties

MemberTypeNotes
CurrentItemGameObjectThe currently equipped item.
HasItemboolWhether an item is currently equipped.
SocketTransformThe socket transform where items are attached.
LocomotionPlayerLocomotionThe player locomotion system (used for crouch offsets).

Methods

MemberSignatureNotes
AttachItemAttachItem(GameObject, Vector3? pos, Vector3? rot)Attaches an item to the hand socket with optional position/rotation offsets.
AttachItemAttachItem(GameObject, ItemAttachmentData)Attaches an item using an ItemAttachmentData configuration (offsets + animation info).
EquipFromContainerEquipFromContainer(GameObject, int slotIndex = -1)Equips an item from a container; activates it and applies ItemHoldData offsets, animator layer, and IK.
UseCurrentItemUseCurrentItem()triggered by the Flashlight/Use input; fires the OnUse event on the equipped item's ItemHoldData.

Events: see Event API.

ItemContainer: orchestration

Manages a list of items and equips them through the socket (it no longer emits its own equip events).

Properties

MemberTypeNotes
CurrentItemGameObjectThe currently equipped item, or null if none.
HasEquippedItemboolWhether an item is currently equipped.
CurrentIndexintThe index of the currently equipped item, or -1 if none.
ItemCountintNumber of items in the container.
HandSocketHandItemSocketThe hand socket this container equips items through; subscribe to its canonical item events (e.g. ItemEquipped).

Methods

MemberSignatureNotes
EquipItemEquipItem(int)Equips an item by index in the items list.
EquipItemByIdEquipItemById(string)Equips an item by its unique ID defined in ItemHoldData.
EquipItemEquipItem(GameObject)Equips a specific item GameObject (must be in the items list).
UnequipCurrentUnequipCurrent()Unequips the currently equipped item.
EquipNextEquipNext()Cycles to the next item in the container (wraps around to index 0).
EquipPreviousEquipPrevious()Cycles to the previous item in the container (wraps around to the last item).
GetItemGetItem(int)Gets an item by index without equipping it.
GetItemByIdGetItemById(string)Gets an item GameObject by its unique ID defined in ItemHoldData.
AddItemAddItem(GameObject)Adds an item to the container's list (deactivated until equipped); fires OnContainerChanged.
RemoveItemRemoveItem(GameObject) → boolRemoves an item from the container; unequips it first if currently equipped; fires OnContainerChanged; returns true if removed.

Event

MemberTypeNotes
OnContainerChangedUnityEventfires when the item list itself changes: add/remove

ItemHoldData: per-item config & reactions

Attach to item GameObjects.

MemberTypeNotes
itemIdstringidentity; unique identifier used to equip items via code or ID-based systems. (default: "NewItem")
OnEquipUnityEventitem-local event; fires alongside the system events
OnUnequipUnityEventitem-local event; fires alongside the system events
OnUseUnityEventitem-local event; fires alongside the system events
attachmentDataItemAttachmentDataconfig
worldItemPrefabGameObjectconfig; should carry a WorldItem component; prefab to spawn when this item is dropped
ItemIdstringproperty; unique identifier for this item
AttachmentDataItemAttachmentDataproperty; configuration for how this item is attached and held
WorldItemPrefabGameObjectproperty; prefab used when dropping this item into the world

ItemAttachmentData: hold & IK config

[Serializable].

MemberTypeNotes
animatorLayerIndexintThe index of the override animation layer for this item; used to play specific hold/use animations. (default: 1)
holdStyleOneHandedRight | TwoHandedDefines if the item is held with one hand or two hands. (default: OneHandedRight)
gripPositionOffsetVector3Local position offset of the item mesh relative to the hand socket transform. (default: Vector3.zero)
gripRotationOffsetVector3Local rotation offset of the item mesh relative to the hand socket transform (Euler angles). (default: Vector3.zero)
debugModebooleditor-only; tune live in the editor; when enabled, offsets update in real-time (field lives on ItemHoldData). (default: false)
tuneGripModebooleditor-only; tune live in the editor; when enabled, transform changes are captured into the grip offsets (field lives on ItemHoldData). (default: false)

Plus standing/crouching hand and elbow IK overrides.

ItemIKPreset: share IK config

ScriptableObject (Create ▸ Player ▸ Item IK Preset).

MemberSignatureNotes
CaptureFromSceneCaptureFromScene()context menu; copies IK config between items
ApplyToSceneApplyToScene()context menu; copies IK config between items

Event API: PlayerEventAPI

Three complementary mechanisms, each fired once per transition from a single canonical chokepoint:

MechanismFor
C# event Action<TArgs>code subscribers (struct args, no per-call allocation)
UnityEventInspector / no-code wiring
Listener interfacesfull extension / structured contract; auto-discovered

Event payloads

  • ItemEquipArgs: Item (GameObject), SlotIndex (int, -1 if equipped outside a container), HoldData (ItemHoldData), FromContainer (bool).
  • LandArgs: ImpactVelocity (float), FallDistance (float).

Item events: HandItemSocket

C# events

MemberTypeNotes
ItemEquippedevent Action<ItemEquipArgs>
ItemUnequippedevent Action<ItemEquipArgs>

Inspector

MemberTypeNotes
OnItemEquippedItemEvent : UnityEvent<GameObject>
OnItemUnequippedItemEvent : UnityEvent<GameObject>

Fire for every socket-backed equip/unequip (manual attach, container equip, detach).

Locomotion events: PlayerLocomotion

C# events

MemberTypeNotes
JumpedAction<LandArgs>
LandedAction<LandArgs>
CrouchStartedActionfires when crouch begins
CrouchEndedActionfires when crouch ends
SprintStartedActionfires when sprint begins
SprintEndedActionfires when sprint ends
GroundedChangedAction<bool>

Inspector UnityEvent mirrors

MemberNotes
OnJumped
OnLanded
OnCrouchStarted
OnCrouchEnded
OnSprintStarted
OnSprintEnded

Listener interfaces

Implement on any MonoBehaviour under the player; it's found at startup automatically. Unhandled methods are no-ops; override only what you need.

using Player;

public class MyListener : MonoBehaviour, IItemEventListener, ILocomotionEventListener
{
    public void OnItemEquipped(ItemEquipArgs args) => Debug.Log($"equipped {args.Item.name}");
    public void OnItemUnequipped(ItemEquipArgs args) { }
    public void OnLanded(LandArgs args) => Debug.Log($"landed at {args.ImpactVelocity}");
    // OnJumped, OnCrouchStarted/Ended, OnSprintStarted/Ended, OnGroundedChanged default to no-op
}

Runtime-added listeners:

MemberNotes
locomotion.RegisterListener(ILocomotionEventListener)register a locomotion listener
socket.RegisterListener(IItemEventListener)register an item listener
UnregisterListener(...)matching unregister on both

Subscribe in code

player.Locomotion.Jumped += () => Debug.Log("jumped");
player.HandItemSocket.ItemEquipped += args =>
    Debug.Log($"equipped {args.Item.name} from slot {args.SlotIndex}");

FPCutter: FPCutterController

Hides body parts in first person (default: Head) while keeping shadow casting. Generated by the FPCutter Wizard.

Methods

MemberSignatureNotes
SetFirstPersonSetFirstPerson()
SetThirdPersonSetThirdPerson()
HidePartHidePart(BodyPart)
ShowPartShowPart(BodyPart)

Config

MemberTypeNotes
HideInFirstPersonList<BodyPart>
invisibleMaterialMaterialuses the FPCutter_Invisible shader

The BodyPart enum is defined in FPCutterData.

Animator: PlayerAnimatorController

Drives animator parameters and item animation layers.

MemberType / SignatureNotes
SetItemLayerSetItemLayer(int)
SetFlashlightActiveSetFlashlightActive(bool)
ToggleFlashlightToggleFlashlight()
TriggerAnimationTriggerAnimation(string)
GetAnimatorGetAnimator() → Animator
IsFlashlightActiveproperty

Procedural IK (advanced)

Tuned by the Setup Wizard; adjust only for advanced customization.

PlayerHeadIK

MemberType / SignatureNotes
Weightget/set
SetWeightSetWeight(float)
SetWeightsSetWeights(body, head, eyes, clamp)
SetEnabledSetEnabled(bool)

PlayerHandIK

MemberType / SignatureNotes
IKPositionWeightget/set
SetEnabledSetEnabled(bool)

PlayerSpineStabilizer

[RequireComponent(typeof(Animator))]; aligns spine yaw to the camera.

Demo & Editor code (not part of the runtime API)

Demo (Project/Scripts/Player/Demo/): PlayerEventLogger (implements both listener interfaces; copy it as a template), PlayerDropSystem, PlayerInventory, PlayerInteraction, WorldItem. Editor: custom inspectors plus the setup wizards; Tools ▸ First Person ▸ Setup Wizard, the Item Container setup, and the FPCutter Wizard.

Easy FP Full Body Controller is available as a paid asset in the Asset Store.

View on Asset Store ↗
Back to top ↑