Vixen
dd8b0a81
csharp
public struct CharacterMovement

How a character walks. The authored half.

Read the guide page for this →

Remarks

Beside a CharacterMovement, PhysicsScene gives an entity a CharacterController and drives it from the entity's MoveIntent — so a walking player is this component, a MoveIntent, and nothing else. What writes the intent is not this assembly's business: a player controller, an AI planner and a replay are indistinguishable from here, which is the point of the seam ([29](../../../docs/plan/29-players-and-possession.md)).

The defaults describe the same human CharacterControllerSettings does — 1.8 m in a 0.3 m capsule — walking at 4 m/s, sprinting at 7, and jumping about 1.1 m.

Fields and properties (26)

  • public ShapeId Shape

    The collision volume while standing.

  • public ShapeId CrouchShape

    The collision volume while crouching, or none to make crouching do nothing.

  • public PhysicsLayer Layer

    Which layer the character collides against.

  • public Vector3 ShapeOffset

    Where the shape's centre sits relative to the entity's origin, in the entity's own frame.

  • public Vector3 CrouchShapeOffset

    The same, for CrouchShape.

  • public float MaxSlopeAngle

    The steepest slope the character can stand on, in radians.

  • public float StepHeight

    How tall a step the character can walk up without jumping, in metres.

  • public float WalkSpeed

    Top speed on the ground, in metres a second.

  • public float SprintSpeed

    Top speed while MoveButtons.Sprint is held.

  • public float CrouchSpeed

    Top speed while crouched.

  • public float Acceleration

    How hard the character accelerates towards its wanted speed on the ground, in m/s².

  • public float AirAcceleration

    The same, in the air. Usually much smaller.

  • public float Gravity

    Downward acceleration while not walking, in m/s². Negative.

  • public float JumpSpeed

    How fast the character leaves the ground when it jumps, in metres a second.

  • public float CoyoteTime

    How long after walking off a ledge a jump still works, in seconds.

  • public float JumpBufferTime

    How long before landing a jump press is remembered, in seconds.

  • public float JumpCutSpeed

    The upward speed a jump is cut to when the button is released early, in metres a second.

  • public bool TurnWithAim

    Whether the character turns to face where its intent says it is looking.

  • public float SwimSpeed

    Top speed in water, in metres a second.

  • public float SwimAcceleration

    How hard the character accelerates towards its wanted speed in water, in m/s².

  • public float SwimThreshold

    How submerged the character has to be to start swimming, 0…1 of the capsule.

  • public float WadeThreshold

    How far the immersion has to fall before a swimmer wades again, 0…1.

  • public float SwimRestImmersion

    How submerged a floating character settles at, 0…1 of the capsule.

  • public float SwimDrag

    How fast the water damps a swimmer's vertical motion, per second.

  • public float WadeSpeedScale

    How much slower wading is at the wade threshold, 0…1 of the walk speed.

  • public static CharacterMovement Default

    A human: 4 m/s walking, 7 sprinting, 2 crouched, jumping about 1.1 m under doubled gravity.

Methods (3)

  • public static float JumpSpeedForHeight(float height, float gravity)

    The JumpSpeed that reaches a given apex under a given gravity.

  • public static float ResolveMaxSlopeAngle(float value)

    The steepest slope a written MaxSlopeAngle actually asks for.

  • public static float ResolveStepHeight(float value)

    The step a written StepHeight actually asks for.

Used by (17)

  • PlayerRigThirdPersonShooter
  • CharacterAllocationTestsVixen.Physics.Tests
  • CharacterMotionVixen.Physics
  • CharacterMotionTestsVixen.Physics.Tests
  • CharacterMovementSystemVixen.Physics
  • CharacterSceneTestsVixen.Physics.Tests
  • CharacterSwimmingTestsVixen.Physics.Tests
  • ComponentRegistrationVixen.Physics
  • MachineVixen.Net.Physics.Tests
  • PhysicsSceneVixen.Physics
  • PhysicsSceneComponentTestsVixen.Physics.Tests
  • PredictedPlayerMovementTestsVixen.Net.Physics.Tests
  • TypeRegistrationVixen.Physics
  • Vixen_Physics_Characters_CharacterMovementSerializerVixen.Physics
  • WaterImmersionSystemVixen.Water.Physics
  • WaterImmersionSystemTestsVixen.Water.Physics.Tests
  • MaterialIconsVixen.Editor.App