Vixen
02b45cc4
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 (17)

  • 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 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 static CharacterMovement Default

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

Methods (1)

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

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

Used by (11)

  • PlayerRigThirdPersonShooter
  • CharacterAllocationTestsVixen.Physics.Tests
  • CharacterMotionVixen.Physics
  • CharacterMotionTestsVixen.Physics.Tests
  • CharacterMovementSystemVixen.Physics
  • CharacterSceneTestsVixen.Physics.Tests
  • ComponentRegistrationVixen.Physics
  • MachineVixen.Net.Physics.Tests
  • PhysicsSceneVixen.Physics
  • PredictedPlayerMovementTestsVixen.Net.Physics.Tests
  • Vixen_Physics_Characters_CharacterMovementSerializerVixen.Physics