Plush

PhysicsShape#

PlushEngine · Type index

Namespace: PlushEngine.Physics (using PlushEngine.Physics;)

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#

PropertyTypeAccessConstructor default
KindPhysicsShapeKindget; init;required
SizeVector3get; init;required
Radiusfloatget; init;.5f
Heightfloatget; init;1f
MeshIdstring?get; init;null
MeshScaleVector3get; 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);

MeshAsset · PhysicsShapeKind

Source#