Vixen
02b45cc4
csharp
public struct PhysicsBody

The body an entity has in the physics world. Written by the bridge, never by game code.

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

Remarks

Present exactly while a body exists, so "has a body" is an archetype question and the bridge finds the entities that still need one with WithNone<PhysicsBody> rather than by scanning for a sentinel.

Deliberately not [DataContract]. A body handle means nothing outside the world that issued it, so saving one into a scene file would restore a handle to whatever body happened to take that slot — the same reason Entity is never written to a scene. The bridge rebuilds this from Collider on the first sync after a load.

⚠ That absence is also what keeps it out of SceneComponentRegistry, and it is load-bearing. A scene component is one carrying [Component] and [DataContract]; this deliberately has neither, so nothing has to remember to exclude it. Adding either to make it inspectable would make a compiled scene able to name it, which is the failure the paragraph above describes.

Fields and properties (4)

  • public BodyHandle Handle

    The body.

  • public ShapeId BuiltShape

    What the body was built from, so the bridge can tell a component edit from a no-op.

  • public BodyMotion BuiltMotion

    The motion type the body was built with.

  • public bool BuiltSensor

    Whether the body was built as a sensor.

Used by (6)

  • PhysicsDebugDrawSystemVixen.Physics
  • PhysicsSceneVixen.Physics
  • PhysicsSceneComponentTestsVixen.Physics.Tests
  • PhysicsSceneTestsVixen.Physics.Tests
  • PhysicsSyncSystemVixen.Physics
  • PhysicsWritebackSystemVixen.Physics