SmoothLocomotionSettings
A class in Root.Township, the global namespace.
Global tuning for the player's smooth (stick) locomotion: speeds, step and slope handling, falling, fall damage and safety recovery. Get it with GlobalSettings<SmoothLocomotionSettings>.Instance; read by SmoothLocomotion.
- Listed in Global namespace: S
- Inherits or implements
GlobalSettings<SmoothLocomotionSettings> - Derived types
SmoothLocomotionSettings - Attributes
GlobalSettings
Constructors
| Member | What it is |
|---|---|
SmoothLocomotionSettings() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
42 private and internal fields
| Member | What it is |
|---|---|
private float clampedSpeed | Top speed for stick movement; faster input movement is clamped to it. |
private float combatSpeedMultiplier | Speed multiplier applied in combat. |
private float dangerDamage | Backing field for DangerDamage. |
private LayerMask dangerMask | Layers counted as dangerous; a safe spot can't be within 1 m of them. |
private float decelerateLerp | How fast speed falls off when you let go. |
private PlayerMode disableRotatorOnActiveHandFor | Backing field for DisableRotatorOnActiveHandFor. Defaults to every mode. |
private float distanceToCheckForInfiniteFall | How far down to look for ground; if none is found the player is moved to safety. |
private float extraHeight | Added to the head height when working out the body height. |
private AnimationCurve fallCrippleDamageOverDistance | Curve from fall height to cripple damage. |
private AnimationCurve fallDamageOverDistance | Curve from fall height to fall damage. Its last key sets maxFallDistance. |
private SoundEffectSet fallDamageSound | Sound played on landing. |
private AnimationCurve fallEffectsScaleOverDistance | Curve from fall height to the size of the landing effect. |
private AnimationCurve fallingControlOverTime | Curve from time falling to how much steering you keep. |
private float gravityMultiplier | Scale on gravity for the smooth locomotion body. |
private float hasMovedSensitivitySquared | Squared distance the local player's feet must move to count as having moved. |
private AnimationCurve heightAdjustmentLerp | Curve used by LerpHeight to ease the body height toward its target. |
private HungerStat hungerStatDefinition | Hunger stat whose level decides if CanRun allows running. |
private float hungrySoundCooldown | Seconds between plays of the too-hungry-to-run sound. |
private AnimationCurve inputCurve | Curve from stick amount to speed. |
private float leanLimit | How far the body can lean away from the head before it is pulled back. |
private float maxAngleBeforeSlopeDot | Slope steepness (as a normal y value) past which the player slides. |
private float maxFallDistance | Fall height at the end of the damage curve. Set by OnValidate. |
private int maxLevelToRun | Hunger level at or below which running needs some fullness. |
private float minDistanceForEffect | Backing field for MinDistanceForEffect. |
private float minimumHeight | Lowest the body height can go. |
private float minimumVelocity | Lowest move speed used once moving. Also read by AI regain control. |
private float normalStepHeight | Usual step height, and a floor on the body height. |
private TransformScaledEvent onHitGroundEffectScaled | Effect played on landing, scaled by the fall. |
private float pressAccelerateLerp | How fast you speed up while running (stick pressed). |
private float pressedSpeed | Running speed with the stick pressed. |
private float recoverFromSafetyRepositionBlackFadeDuration | Seconds the screen stays black after a safety move before fading back. |
private float recoverFromSafetyRepositionDuration | Total seconds of the recover state after being moved to safety. |
private float recoveryFadeBlackness | Blackness for the recovery fade. Nothing reads it in this build. |
private LayerMask safetyMask | Layers that count as safe ground to be moved back to. |
private float slipValueIncreaseDuration | Seconds for sliding on a steep slope to build to full. |
private float slopeHelperDistance | Extra distance for ground checks that keep you stuck to slopes. |
private float slopeMultiplier | How strongly a steep slope pushes you down it. |
private LayerMask standableMask | Layers you can stand on. |
private float teleportFallTimer | The teleporter only switches on while you have been falling for less than this many seconds. |
private float touchAccelerateLerp | How fast you speed up while walking. |
private float touchedSpeed | Walking speed. |
private SoundEffectSet tryingToRunSound | Sound played when you try to run while too hungry. |
Properties
| Member | What it is |
|---|---|
float ClampedSpeed { get; } | Top horizontal speed movement is clamped to. |
float CombatSpeedMultiplier { get; } | Speed multiplier applied while in combat. |
float DangerDamage { get; } | Damage value for danger layers. Nothing reads it in this build. |
LayerMask DangerMask { get; } | Layers counted as dangerous; a safe recovery point can't be within 1 m of them. |
float DecelerateLerp { get; } | How fast movement speed falls off when input stops. |
PlayerMode DisableRotatorOnActiveHandFor { get; } | Player modes for which turning is meant to be disabled on the active hand. Nothing reads it in this build. |
float DistanceToCheckForInfiniteFall { get; } | How far down to look for ground; with none in range the player is moved back to safety. |
float ExtraHeight { get; } | Added to the head height when working out the character height. |
AnimationCurve FallCrippleDamageOverDistance { get; } | Curve from fall height to the crippling part of fall damage. |
AnimationCurve FallDamageOverDistance { get; } | Curve from fall height to fall damage. Its last key sets MaxFallDistance. |
SoundEffectSet FallDamageSound { get; } | Sound played on fall damage. |
AnimationCurve FallEffectsScaleOverDistance { get; } | Curve from fall height to the scale of the landing effect. |
AnimationCurve FallingControlOverTime { get; } | Curve from time spent falling to how much input control is left. |
float GravityMultiplier { get; } | Gravity multiplier for the player. |
float HasMovedSensitivitySquared { get; } | Squared distance the local player's feet must move before it counts as having moved. |
float HungrySoundCooldown { get; } | Minimum seconds between "too hungry to run" sounds. |
AnimationCurve InputCurve { get; } | Curve applied to stick input strength. |
float LeanLimit { get; } | How far the head can lean from the body before the character is repositioned. |
float MaxAngleBeforeSlopeDot { get; } | Ground normal Y below which the ground counts as a slope you slide on. |
float MaxFallDistance { get; } | Largest fall distance that is synced; copied from the fall damage curve's last key. |
float MinDistanceForEffect { get; } | Minimum fall distance for the landing effect. Nothing reads it in this build. |
float MinimumHeight { get; } | Lowest the character height can be. |
float MinimumVelocity { get; } | Lowest move speed while input is applied. Creatures regaining control also use it. |
float NormalStepHeight { get; } | Step height the character controller uses. |
TransformScaledEvent OnHitGroundEffectScaled { get; } | Effect event raised on landing, scaled by fall height. |
float PressAccelerateLerp { get; } | How fast speed builds up when the stick is pressed (running). |
float PressedSpeed { get; } | Move speed when the stick is pressed in. |
float RecoverFromSafetyRepositionBlackFadeDuration { get; } | Fade to black time when the player is moved back to safety. |
float RecoverFromSafetyRepositionDuration { get; } | How long the move back to safety takes. |
float RecoveryFadeBlackness { get; } | How dark the screen goes during safety recovery. |
LayerMask SafetyMask { get; } | Layers a player can be put back onto when moved to safety. |
float SlipValueIncreaseDuration { get; } | Seconds for sliding on a steep slope to build up to full. |
float SlopeHelperDistance { get; } | Extra distance below the feet checked for ground, to stick to slopes. |
float SlopeMultiplier { get; } | Strength of sliding down a steep slope. |
LayerMask StandableMask { get; } | Layers the player can stand on. |
float TeleportFallTimer { get; } | Seconds of falling after which the teleporters are turned off. |
float TouchAccelerateLerp { get; } | How fast speed builds up when the stick is only touched (walking). |
float TouchedSpeed { get; } | Move speed when the stick is only touched. |
SoundEffectSet TryingToRunHungrySound { get; } | Sound played when the player tries to run while too hungry. |
float WalkingSpeedMultiplier { get; set; } | Runtime multiplier on walking speed. Settable. |
Methods
| Member | What it is |
|---|---|
bool CanRun(Stat hungerStat, Stat fullnessStat) | True unless the hunger stat is enabled and at level 2 or lower; then running needs some fullness left. |
float LerpHeight(float currenty, float targetY) | Smooths a height towards a target using the height adjustment curve. |
1 private and internal method
Used in
Members of other types that take, return or hold a SmoothLocomotionSettings: