BP_CrouchingComponent
This page describes the Crouching Component that ships with Motion. The Crouching Component provides smooth crouching and uncrouching for characters.
It also provides floor & ceiling detection to prevent the capsule from expanding too much when uncrouching, but still allowing for partial uncrouching if the ceiling height allows it. A speed penalty is applied when being fully crouched.
Dependencies
requires BP_JumpingComponent.
Methods
Crouch Handlers
Name | Description |
---|---|
DoCrouch | Logic for Crouching. See comments for details. |
DoUncrouch | Logic for Uncrouching. See comments for details. |
HandleCrouchInput | Handles input set by player input |
SetCrouch | Updates crouch states. Used by input events. |
Getters
Name | Description |
---|---|
GetCapsuleOverlapCheckResult | Checks if the player would be still enroached if we'd adjust their position |
GetCharacterVelocity | Returns the player speed in units per second. |
Event Handler
Name | Description |
---|---|
HandleOnCrouchCrouched | Called whenever the crouch position updates. Calls event for other components that listen to crouch changes. Useful for implementing sliding. |
HandleOnCrouchPressed | Upon crouch key-press, mark the character as wanting to crouch |
HandleOnCrouchReleased | When releasing the crouch button, update crouch intention state |
HandleOnCrouchUncrouched | Called whenever the uncrouch position updates. Calls event for other components that listen to uncrouch changes. Useful for implementing sliding. |
HandleOnEventBeginPlay | Called when "Event Begin Play" gets called. Sets up events and saves base values. |
HandleOnEventTick | Core logic handlers. Handles Crouch Inputs and prints Debug information |
HandleOnMovementModeChanged | Handles all Movement related changes |
Event Dispatchers
Name | Description |
---|---|
OnCrouchUpdate | Triggered when the capsule size changes due to crouching or uncrouching. |
OnCrouchFullyCrouched | Triggered when the player is fully crouched. |
OnCrouchFullyUncrouched | Triggered when the player is fully uncrouched. |
Debug
Name | Description |
---|---|
PrintDebugInformation | Prints useful information on the screen. Helpful for debugging. |
Manipulators
Name | Description |
---|---|
ResetMaxWalkSpeed | Removes the crouch speed modifiers |
Variables
Configuration
Name | Description |
---|---|
TargetCrouchCameraOffset | Camera Offset to add when the player is crouching. |
ClassExceptionListForOverlap | Array of Actor classes that are being ignored in ceiling checks. |
bIsInputToggle | If true, the input key is used as toggle. This is especially useful for use on gamepads where it is more tiring to hold down a button. |
bShowDebugInformation | If true, various useful variables will be printed on the screen to help with debugging. |
bIsEnabled | If false, the component will only print debug data and not update any other values. |
Component Data
Name | Description |
---|---|
OverlapActorTypes | Actor Types that are used for collision detection when uncrouching. |
Event Dispatcher
Name | Description |
---|---|
OnCrouchFullyUncrouched | Triggered when the player is fully uncrouched. |
OnCrouchFullyCrouched | Triggered when the player is fully crouched. |
OnCrouchUpdate | Triggered when the capsule size changes due to crouching or uncrouching. |
States
Name | Description |
---|---|
bCrouchMaintainsBaseLocation | If true, crouching should keep the base of the capsule in place by lowering the center of the shrunken capsule. |
bIsCrouched | If true, the player is fully crouched. |
bIsInCrouch | If true, the player is currently transitioning in a crouch. |
bWantsToCrouch | If true, the player signalised, usually by pressing the crouch button, that they want to crouch. |
Default
Name | Description |
---|---|
JumpingComponent | Reference to the jumping component. |
Last updated