public sealed class PhysicsShapesEvery collision volume the world knows about, each built once and shared by everything that asked for the same thing.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Registration interns. Registering the same description twice returns the same ShapeId and reuses the one native shape behind it. A level of ten thousand identical crates therefore builds one BoxShape, and — because Jolt's shapes are immutable and reference-counted — every body pointing at it shares its bounding volume hierarchy, its mass properties and its cache lines.
Native shapes are built lazily and freed together. A description is cheap; a mesh shape is a bounding-volume tree over a hundred thousand triangles. Nothing is built until a body actually asks, and everything is freed when the registry is disposed — which happens after the physics system it fed, because Jolt reads a shape while removing the last body that used it.
Not thread-safe, deliberately. Registration happens while a scene is loading or while gameplay code is running, never from inside a step; a lock on the interning table would be paid on every lookup to protect a path that has no concurrency in it. The one place it would matter — the ECS bridge creating bodies — runs on the main thread at a sync point.
Fields and properties (7)
public const float DefaultConvexRadiusHow far Jolt shrinks a convex shape before rounding it back out, in metres.
public const float NoCollisionHeightThe height that means "there is no ground here".
public const int MaxHeightFieldBlockSizeThe largest block a height field's acceleration structure is built over.
public const int MinHeightFieldSampleCountThe smallest height field Jolt will accelerate.
public int CountHow many distinct shapes are registered.
public int BuiltCountHow many have actually been built as native shapes.
public bool IsDisposedWhether Dispose has been called.
Methods (19)
public ShapeId Register(in ShapeDescription description)Registers a description, or finds the id it already has.
public ShapeId Sphere(float radius)Registers a sphere.
public ShapeId Box(Vector3 halfExtents)Registers a box.
public ShapeId Box(float halfExtent)Registers a cube.
public ShapeId Capsule(float halfHeight, float radius)Registers a capsule standing on the Y axis.
public ShapeId Cylinder(float halfHeight, float radius)Registers a cylinder standing on the Y axis.
public ShapeId Plane(Vector3 normal, float distance = 0)Registers an infinite half-space.
public ShapeId ConvexHull(ReadOnlySpan<Vector3> points)Registers the convex hull of a point cloud.
public ShapeId Mesh(ReadOnlySpan<Vector3> vertices, ReadOnlySpan<int> indices)Registers a triangle mesh.
public ShapeId HeightField(ReadOnlySpan<float> heights, int sampleCount, Vector3 offset, Vector3 scale)Registers a regular grid of heights over the XZ plane.
public ShapeId Compound(ReadOnlySpan<CompoundChild> children)Registers several shapes rigidly attached to one another.
public ShapeDescription Describe(ShapeId id)What a registered id describes.
public ReadOnlySpan<Vector3> PointsOf(ShapeId id)The points a hull or a mesh was registered with.
public ReadOnlySpan<int> IndicesOf(ShapeId id)The triangle indices a mesh was registered with.
public ReadOnlySpan<CompoundChild> ChildrenOf(ShapeId id)The children a compound was registered with.
public ReadOnlySpan<float> HeightsOf(ShapeId id)The samples a height field was registered with.
public HeightFieldPlacement HeightFieldOf(ShapeId id)Where a height field's samples sit.
public static int HeightFieldBlockSize(int sampleCount)Which block size Jolt's acceleration structure uses for a given sample count.
public void Dispose()
Used by (22)
- ArenaThirdPersonShooter
- ArenaCameraOcclusionThirdPersonShooter
- PlayerRigThirdPersonShooter
- CharacterAllocationTestsVixen.Physics.Tests
- CharacterControllerVixen.Physics
- CharacterControllerTestsVixen.Physics.Tests
- CharacterSceneTestsVixen.Physics.Tests
- HeightFieldShapeTestsVixen.Physics.Tests
- JoltMathTestsVixen.Physics.Tests
- LagCompensationTestsVixen.Net.Physics.Tests
- MachineVixen.Net.Physics.Tests
- PhysicsConstraintTestsVixen.Physics.Tests
- PhysicsDebugDrawVixen.Physics
- PhysicsDeterminismTestsVixen.Physics.Tests
- PhysicsLayerTestsVixen.Physics.Tests
- PhysicsOcclusionTestsVixen.Audio.Physics.Tests
- PhysicsQueryTestsVixen.Physics.Tests
- PhysicsSceneVixen.Physics
- PhysicsSceneTestsVixen.Physics.Tests
- PhysicsShapeTestsVixen.Physics.Tests
- PhysicsWorldVixen.Physics
- PhysicsWorldTestsVixen.Physics.Tests