# BP\_CharacterCoreComponent

This page describes the CharacterCore Component that ships with Motion. The Character Core component provides commonly-used functions for all Curved Motion components and manages camera offsets and player speeds for the Motion Character.

We use this central approach for camera and speed changes to allow multiple sources of changes, where each component only has to manage their own adjustments, avoiding complex logic and computations.

### Dependencies

* Requires the owning Blueprint to be BP\_MotionCharacter.
* Said character must own: A camera, a character movement component, a capsule & a scene component acting as center actor for the dynamic resizing functionality.

### Methods

#### Camera Location Offset

| Name                                | Description                                                                                                                                                                  |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AddCameraLocationOffset             | Adds a location of type Vector to the CameraVectors dictionary                                                                                                               |
| AddHeadMovementCameraLocationOffset | Get the player's control rotation and add it to the location offset dictionary to prevent camera clipping into the mesh.                                                     |
| CalculateCameraLocation             | Combines the vectors from the CameraVectors dictionary to a combined camera location offset. If a priority component is selected, it will instead use that component's value |
| FlushCameraLocationOffsets          | Deletes all vectors from the currently dictionary.                                                                                                                           |

#### Camera

| Name                         | Description                                                                                                                                           |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| AddCameraOffset              | Adds a rotator for a provided component to the dictionary.                                                                                            |
| CalculateCameraOffset        | Gets all values from the Camera Offsets Dictionary and combines them to a single Rotator.                                                             |
| FindCameraOffsetByIdentifier | Tries to find a camera offset by its curve identifier and returns it. Returns -1 if none was found.                                                   |
| FlushCameraOffsets           | Deletes all rotators from the currently dictionary.                                                                                                   |
| RemoveCameraOffset           | Tries to find the provided component and removes it registered offset from the dictionary. If the component is the override one, delete the override. |

#### Walk Speed

| Name               | Description                                                                                                                                                 |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AddWalkSpeed       | Adds a speed of type float to the WalkSpeed dictionary                                                                                                      |
| CalculateWalkSpeed | Combines the speeds from the WalkSpeeds dictionary to combined walk speed. If a priority component is selected, it will instead use that component's value. |
| FlushWalkSpeeds    | Deletes all rotators from the currently dictionary.                                                                                                         |

#### Components

| Name              | Description                                                                             |
| ----------------- | --------------------------------------------------------------------------------------- |
| GetCoreComponents | Get required components Character, Movement, Camera & Capsule and save their references |

#### Core

| Name              | Description                                                                                     |
| ----------------- | ----------------------------------------------------------------------------------------------- |
| GetGroundInfo     | Finds the current floor and saves information about it                                          |
| HandleOnEventTick | Core logic handler. Calculates camera offset and player speed from data provided by components. |

#### Debug

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

***

### Variables

#### Configuration

| Name                  | Description                                                                                  |
| --------------------- | -------------------------------------------------------------------------------------------- |
| GroundTraceDistance   | Distance in units used, in addition to the capsule half height, to locate the nearest floor. |
| bShowDebugInformation | If enabled, will print useful information on the players screen.                             |

#### Component Data

| Name                                     | Description                                                                                                               |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| InitialCameraLocation                    | Location of the camera when first spawning the player. Used to add the Global Camera Location Offset.                     |
| CachedGroundInfo                         | Information about the last traced floor. Used for animation purposes.                                                     |
| CalculatedCameraLocationOffset           | The current calculated camera location offset of the player in the current frame.                                         |
| PriorityComponentForCameraOffsetOverride | If set, refers to which components speed value will be used. If this is set, all other values will be ignored.            |
| PriorityComponentForCameraOverride       | If set, refers to which curves rotation value will be used. If this is set, all other values will be ignored.             |
| PriorityComponentForSpeedOverride        | If set, refers to which components speed value will be used. If this is set, all other values will be ignored.            |
| CameraVectors                            | Dictionary holding information about what components wants to add what location to the combined camera location.          |
| WalkSpeeds                               | Dictionary holding information about what components wants to add what speed to the combined Max Walk Speed.              |
| CameraOffsets                            | Dictionary holding information about what component wants to add what rotation to the combined offset.                    |
| GlobalCameraLocationOffset               | The combined result of all registered camera location offsets. This vector will be set as the camera\\'s position offset. |
| GlobalCameraOffset                       | The combined result of all registered camera offsets. This rotator will be set as the cameras local offset.               |

#### Default

| Name        | Description                    |
| ----------- | ------------------------------ |
| CenterActor | Reference to the Center Actor. |

#### Components

| Name              | Description                                    |
| ----------------- | ---------------------------------------------- |
| Capsule           | Reference to the Character Capsule Collision.  |
| CharacterMovement | Reference to the Character Movement Component. |
| Camera            | Reference to the Character Blueprint Camera.   |
| Character         | Reference to the Character blueprint.          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://motion.docs.regensturm.com/components/bp_charactercorecomponent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
