Class BeastCharacterGroundAlignment
Optional Beast helper for CharacterController movement on uneven ground.
Inheritance
Namespace: CreatureKit.Beasts
Assembly: CreatureKit.Beasts.Runtime.dll
Syntax
public sealed class BeastCharacterGroundAlignment : MonoBehaviour
Constructors
BeastCharacterGroundAlignment()
Declaration
public BeastCharacterGroundAlignment()
Properties
Controller
CharacterController owned by the same GameObject as this helper.
Declaration
public CharacterController Controller { get; }
Property Value
| Type | Description |
|---|---|
| CharacterController |
Methods
AlignVisualToGround(Vector3, Vector3, float, float)
Rotates the generated Beast visual root toward the slope while keeping the CharacterController upright.
Declaration
public void AlignVisualToGround(Vector3 velocity, Vector3 desiredUp, float rotationSpeed, float deltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | velocity | Current movement velocity used to resolve facing direction. |
| Vector3 | desiredUp | Ground-up direction returned by GetDesiredGroundUp(float). |
| float | rotationSpeed | Maximum visual rotation speed in degrees per second. |
| float | deltaTime | Frame time. |
DrawGroundProbeDebugLines()
Draws Play Mode debug lines for the configured ground probes.
Declaration
public void DrawGroundProbeDebugLines()
FitControllerToBeast()
Resizes the CharacterController capsule from the generated Body and Legs render bounds.
Declaration
public void FitControllerToBeast()
GetDesiredGroundUp(float)
Samples and smooths the desired ground-up direction.
Declaration
public Vector3 GetDesiredGroundUp(float deltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | deltaTime | Frame time used by the smoothing filter. |
Returns
| Type | Description |
|---|---|
| Vector3 | Smoothed ground-up direction, preserving the last valid direction while every foot probe misses. |
ProjectVelocityOnGround(Vector3, Vector3)
Projects a velocity onto the sampled ground plane while preserving horizontal speed.
Declaration
public Vector3 ProjectVelocityOnGround(Vector3 velocity, Vector3 groundNormal)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | velocity | Input velocity. |
| Vector3 | groundNormal | Ground normal returned by GetDesiredGroundUp(float). |
Returns
| Type | Description |
|---|---|
| Vector3 | Velocity adjusted for the current slope. |
RotateControllerTowards(Vector3, float, float)
Rotates the CharacterController root toward the current movement direction, keeping it upright.
Declaration
public void RotateControllerTowards(Vector3 velocity, float rotationSpeed, float deltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | velocity | Current movement velocity. |
| float | rotationSpeed | Maximum yaw rotation speed in degrees per second. |
| float | deltaTime | Frame time. |