# BP\_SneakingComponent

This page describes the Sneaking Component that ships with Motion. The Sneaking Component provides an alternative movement mode for players. When holding (or pressing) the Sneak Key, the player decelerates towards a sneak speed penaltythat can be configured in this component.

Footsteps also get disabled while sneaking. A deceleration of the player does not get applied if the player starts sneaking when standing still.

Unlike the Sprinting Component, no camera shake is applied.

### Dependencies

* requires BP\_SprintingComponent.

### Methods

#### Event Handler

| Name                   | Description                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------ |
| HandleOnEventBeginPlay | Called when "Event Begin Play" gets called. Sets up events and saves component references. |
| HandleOnEventTick      | Core logic handlers. Handles Sneak Inputs, Updates timers and prints Debug information     |
| HandleOnSneakPressed   | Called when the player presses the sneak key. Resets timers and sets sneak state.          |
| HandleOnSneakReleased  | Called when the player releases the sneak key. Resets sneaking and its state.              |

#### Getters

| Name             | Description                                                                                                                         |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| IsAllowedToSneak | Returns true if the player is allowed to sneak. Returns false if the player is falling, not holding the sprint key or is sprinting. |

#### Manipulators

| Name                     | Description                                                                               |
| ------------------------ | ----------------------------------------------------------------------------------------- |
| LerpTowardsSneakingSpeed | Lerps towards sneak speed and updates the speed for this component in the core component. |
| ResetSneaking            | Removes speed penalty from sneaking.                                                      |
| UpdateDeltaSeconds       | Update the progress on the sneak timer.                                                   |

#### Debug

| Name                  | Description                                                     |
| --------------------- | --------------------------------------------------------------- |
| PrintDebugInformation | Prints useful information on the screen. Helpful for debugging. |

***

### Variables

#### Configuration

| Name                   | Description                                                                                                                            |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| SneakDecelerationCurve | The curve float used to decelerate the player towards the sneaking speed penalty.                                                      |
| 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.                                                    |

#### Default

| Name            | Description                       |
| --------------- | --------------------------------- |
| SprintComponent | Reference to the sprint component |

#### Component Data

| Name                  | Description                                             |
| --------------------- | ------------------------------------------------------- |
| CurrentTargetRotation | The current requested camera offset for this compoenent |

#### States

| Name               | Description                                                  |
| ------------------ | ------------------------------------------------------------ |
| bIsSneaking        | If true, the player is currently sneaking.                   |
| bIsHoldingSneakKey | If true, the player is currently holding down the sneak key. |
