Vixen
02b45cc4
csharp
public record struct BodyDescription

Everything needed to create a body, in one value.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A record struct with initialisers rather than a builder or a long constructor: a body has a dozen knobs, eleven of which are almost always their default, and new BodyDescription { Shape = box, Motion = BodyMotion.Dynamic } says exactly what is unusual about this one and nothing else.

The defaults are Jolt's, except Friction and Restitution, which are Jolt's too — 0.2 and 0 — and are called out because they are the two people reach for first and the two whose defaults are least guessable.

Fields and properties (18)

  • public ShapeId Shape

    The collision volume. Required.

  • public Vector3 Position

    Where the body starts.

  • public Quaternion Rotation

    Which way it starts.

  • public BodyMotion Motion

    How it moves.

  • public BodyMotionQuality MotionQuality

    How carefully its motion is swept.

  • public PhysicsLayer Layer

    Which layer it is on, and so what it collides with.

  • public Vector3 LinearVelocity

    Its starting linear velocity, in metres a second.

  • public Vector3 AngularVelocity

    Its starting angular velocity, in radians a second about each axis.

  • public float Mass

    Its mass in kilograms, or zero to take the shape's — density times volume.

  • public float GravityFactor

    How much of the world's gravity applies. One is all of it; zero is none.

  • public float Friction

    Friction, roughly 0 (ice) to 1 (rubber). Combined with the other body's.

  • public float Restitution

    Bounciness, 0 (clay) to 1 (perfectly elastic). Combined with the other body's.

  • public float LinearDamping

    How quickly linear motion bleeds away, per second.

  • public float AngularDamping

    How quickly angular motion bleeds away, per second.

  • public BodyDegreesOfFreedom DegreesOfFreedom

    Which axes it may move and turn about.

  • public bool IsSensor

    Whether the body reports overlaps instead of resolving them — a trigger volume.

  • public bool AllowSleeping

    Whether the body may fall asleep when it stops moving.

  • public ulong UserData

    Whatever the owner wants to associate with the body. The ECS bridge puts an entity here.

Methods (5)

Used by (14)

  • CharacterControllerTestsVixen.Physics.Tests
  • HeightFieldShapeTestsVixen.Physics.Tests
  • JoltMathTestsVixen.Physics.Tests
  • LagCompensationTestsVixen.Net.Physics.Tests
  • PhysicsConstraintTestsVixen.Physics.Tests
  • PhysicsDeterminismTestsVixen.Physics.Tests
  • PhysicsLayerTestsVixen.Physics.Tests
  • PhysicsOcclusionTestsVixen.Audio.Physics.Tests
  • PhysicsQueryTestsVixen.Physics.Tests
  • PhysicsSceneVixen.Physics
  • PhysicsShapeTestsVixen.Physics.Tests
  • PhysicsWorldVixen.Physics
  • PhysicsWorldTestsVixen.Physics.Tests
  • Vixen_Physics_Bodies_BodyDescriptionSerializerVixen.Physics