PhysicsShape#
Backend-neutral compiled shape data produced from authored shape datablocks.
public readonly record struct PhysicsShape(PhysicsShapeKind Kind, Vector3 Size, float Radius = .5f, float Height = 1f, string? MeshId = null, Vector3 MeshScale = default)Record properties#
| Property | Type | Access | Constructor default |
|---|---|---|---|
Kind | PhysicsShapeKind | get; init; | required |
Size | Vector3 | get; init; | required |
Radius | float | get; init; | .5f |
Height | float | get; init; | 1f |
MeshId | string? | get; init; | null |
MeshScale | Vector3 | get; init; | default |
Members: Box · Capsule · Compound · ConvexHull · Mesh · Parts · Sphere · TriangleMesh
Box#
public static PhysicsShape Box(Vector3 size);Capsule#
public static PhysicsShape Capsule(float radius, float height);Compound#
public static PhysicsShape Compound(IReadOnlyList<PhysicsShape> parts);ConvexHull#
public static PhysicsShape ConvexHull(MeshAsset mesh, Vector3 scale);Mesh#
[System.Text.Json.Serialization.JsonIgnore]
public MeshAsset? Mesh { get; init; }Derived runtime geometry. Packages serialize MeshId and reconnect this to their shared MeshAsset.
Parts#
[System.Text.Json.Serialization.JsonIgnore]
public IReadOnlyList<PhysicsShape>? Parts { get; init; }Convex parts in one rigid body, each in the body's own space (runtime-only; e.g. the intact pieces of a fractured movable object). Parts are shared with the plain shape cache.
Sphere#
public static PhysicsShape Sphere(float radius);TriangleMesh#
public static PhysicsShape TriangleMesh(MeshAsset mesh, Vector3 scale);Related types#
Source#
- PhysicsWorld3D.cs