Class PhysicsMesh
Owns immutable authored triangle topology and committed deterministic runtime mesh geometry.
public class PhysicsMesh
- Inheritance
-
PhysicsMesh
- Inherited Members
Constructors
PhysicsMesh(Vector3d[], int[], Vector3d, FixedQuaternion)
Creates a convex runtime mesh at a world-space pose.
public PhysicsMesh(Vector3d[] vertices, int[] triangles, Vector3d position, FixedQuaternion rotation)
Parameters
verticesVector3d[]trianglesint[]positionVector3drotationFixedQuaternion
PhysicsMesh(Vector3d[], int[], Vector3d, FixedQuaternion, MeshColliderMode)
Creates a runtime mesh with an explicit collision mode and world-space pose.
public PhysicsMesh(Vector3d[] vertices, int[] triangles, Vector3d position, FixedQuaternion rotation, MeshColliderMode mode)
Parameters
verticesVector3d[]trianglesint[]positionVector3drotationFixedQuaternionmodeMeshColliderMode
Fields
MaxTriangleCount
Maximum accepted triangle count for deterministic runtime mesh construction.
public const int MaxTriangleCount = 131072
Field Value
MaxVertexCount
Maximum accepted vertex count for deterministic runtime mesh construction.
public const int MaxVertexCount = 65535
Field Value
Properties
Bounds
Gets the committed world-space axis-aligned bounds.
public FixedBoundBox Bounds { get; }
Property Value
- FixedBoundBox
IsClosedSurface
Gets whether the complete exact-position-welded triangle topology is one connected, consistently wound, closed two-manifold surface.
public bool IsClosedSurface { get; }
Property Value
LocalBounds
Axis-aligned bounds of the source vertices in local mesh space.
public FixedBoundBox LocalBounds { get; }
Property Value
- FixedBoundBox
Mode
Gets the mesh collision mode.
public MeshColliderMode Mode { get; }
Property Value
OwnerScale
Gets the committed host or standalone scale factor.
public Vector3d OwnerScale { get; }
Property Value
- Vector3d
PartScale
Gets the committed authored compound-part scale factor. Standalone meshes use FixedMathSharp.Vector3d.One.
public Vector3d PartScale { get; }
Property Value
- Vector3d
ScaledLocalBounds
Gets the current centered, scaled bounds in mesh-local coordinates.
public FixedBoundBox ScaledLocalBounds { get; }
Property Value
- FixedBoundBox
SurfaceMassProperties
Gets cached uniform thin-shell mass properties for the committed geometry.
public MeshSurfaceMassProperties SurfaceMassProperties { get; }
Property Value
TotalArea
Gets the current triangle surface area after local scale.
public Fixed64 TotalArea { get; }
Property Value
- Fixed64
TriangleBvhBuildCount
Gets the number of committed triangle BVH builds.
public int TriangleBvhBuildCount { get; }
Property Value
TriangleCount
Gets the number of authored triangles.
public int TriangleCount { get; }
Property Value
Triangles
Holds all the triangles that make up the mesh in the form of indices to the vertices array. example: Triangles[0-3] = 4,2,3 means that the first triangle of the mesh is made up of the vertices _vertices[4], _vertices[2], _vertices[3]
public ReadOnlySpan<int> Triangles { get; }
Property Value
VertexCount
Number of vertices in the immutable local mesh topology.
public int VertexCount { get; }
Property Value
Methods
CalculateInertiaTensor(Fixed64)
Calculates closed-volume mesh inertia for the supplied mass.
public Fixed3x3 CalculateInertiaTensor(Fixed64 mass)
Parameters
massFixed64
Returns
- Fixed3x3
CalculateInertiaTensor(Fixed64, MeshInertiaPolicy)
Calculates mesh inertia for the supplied mass using the requested policy. This is a geometry/topology API; callers apply body mobility gates before requesting inertia.
public Fixed3x3 CalculateInertiaTensor(Fixed64 mass, MeshInertiaPolicy policy)
Parameters
massFixed64policyMeshInertiaPolicy
Returns
- Fixed3x3
CalculateInertiaTensor(Fixed64, MeshInertiaPolicy, Vector3d)
Calculates mesh inertia for the supplied mass about a specific local reference point. This is a geometry/topology API; callers apply body mobility gates before requesting inertia.
public Fixed3x3 CalculateInertiaTensor(Fixed64 mass, MeshInertiaPolicy policy, Vector3d localReferencePoint)
Parameters
massFixed64policyMeshInertiaPolicylocalReferencePointVector3d
Returns
- Fixed3x3
ConvertScaledLocalToWorld(Vector3d)
Materializes a scaled-local mesh point in world space.
public Vector3d ConvertScaledLocalToWorld(Vector3d scaledLocalPoint)
Parameters
scaledLocalPointVector3d
Returns
- Vector3d
Exceptions
- InvalidOperationException
The conceptual world point lies outside the representable coordinate domain.
ConvertWorldDirectionToLocal(Vector3d)
Expresses a world-space direction in the committed scaled-local mesh frame.
public Vector3d ConvertWorldDirectionToLocal(Vector3d worldDirection)
Parameters
worldDirectionVector3d
Returns
- Vector3d
ConvertWorldToScaledLocal(Vector3d)
Expresses a world point in the committed scaled-local mesh frame.
public Vector3d ConvertWorldToScaledLocal(Vector3d worldPoint)
Parameters
worldPointVector3d
Returns
- Vector3d
Exceptions
- InvalidOperationException
The exact relative displacement lies outside the representable coordinate domain.
GetFaceNormalWorld(int)
Gets a triangle face normal in world space.
public Vector3d GetFaceNormalWorld(int index)
Parameters
indexint
Returns
- Vector3d
GetFrontalArea(Vector3d)
Gets the projected mesh area facing a world-space direction.
public Fixed64 GetFrontalArea(Vector3d direction)
Parameters
directionVector3d
Returns
- Fixed64
GetLocalTriangleVertices(int, out Vector3d, out Vector3d, out Vector3d)
Gets one triangle's committed scaled vertices in local mesh space.
public void GetLocalTriangleVertices(int index, out Vector3d first, out Vector3d second, out Vector3d third)
Parameters
indexintfirstVector3dsecondVector3dthirdVector3d
GetSupportVertexWorld(Vector3d)
Materializes the world-space vertex with the greatest projection
onto direction, preserving source vertex order
for ties.
public Vector3d GetSupportVertexWorld(Vector3d direction)
Parameters
directionVector3d
Returns
- Vector3d
Exceptions
- InvalidOperationException
The conceptual support vertex lies outside the representable world-coordinate domain.
GetTriangleVertices(int, out Vector3d, out Vector3d, out Vector3d)
Gets one triangle's vertices in world space.
public void GetTriangleVertices(int index, out Vector3d first, out Vector3d second, out Vector3d third)
Parameters
indexintfirstVector3dsecondVector3dthirdVector3d
GetTrianglesInLocalBounds(FixedBoundVolume, SwiftList<int>)
Writes triangle indices overlapping scaled-local bounds into a caller-owned buffer.
public void GetTrianglesInLocalBounds(FixedBoundVolume localBounds, SwiftList<int> result)
Parameters
localBoundsFixedBoundVolumeresultSwiftList<int>
GetTrianglesInWorldBounds(FixedBoundVolume, SwiftList<int>)
Writes triangle indices overlapping world-space bounds into a caller-owned buffer.
public void GetTrianglesInWorldBounds(FixedBoundVolume worldBounds, SwiftList<int> result)
Parameters
worldBoundsFixedBoundVolumeresultSwiftList<int>
GetVertexWorld(int)
Materializes one scaled vertex in world space.
public Vector3d GetVertexWorld(int index)
Parameters
indexint
Returns
- Vector3d
Exceptions
- InvalidOperationException
The conceptual vertex lies outside the representable world-coordinate domain.
TryConvertScaledLocalToWorld(Vector3d, out Vector3d)
Attempts to materialize a scaled-local mesh point in world space.
public bool TryConvertScaledLocalToWorld(Vector3d scaledLocalPoint, out Vector3d worldPoint)
Parameters
scaledLocalPointVector3dworldPointVector3d
Returns
TryConvertWorldDirectionToLocal(Vector3d, out Vector3d)
Attempts to express a world-space direction in the committed scaled-local mesh frame.
public bool TryConvertWorldDirectionToLocal(Vector3d worldDirection, out Vector3d localDirection)
Parameters
worldDirectionVector3dlocalDirectionVector3d
Returns
TryConvertWorldToScaledLocal(Vector3d, out Vector3d)
Attempts to express a world point in the committed scaled-local mesh frame without saturating the relative displacement.
public bool TryConvertWorldToScaledLocal(Vector3d worldPoint, out Vector3d localPoint)
Parameters
worldPointVector3dlocalPointVector3d
Returns
TryGetClosedVolumeMassProperties(out MeshMassProperties, out MeshVolumeValidationResult)
Gets cached closed-volume mass properties when this mesh is a valid closed triangle shell.
public bool TryGetClosedVolumeMassProperties(out MeshMassProperties properties, out MeshVolumeValidationResult result)
Parameters
propertiesMeshMassPropertiesresultMeshVolumeValidationResult
Returns
TryGetSupportVertexWorld(Vector3d, out Vector3d)
Attempts to materialize the world-space vertex with the greatest
projection onto direction, preserving source
vertex order for ties.
public bool TryGetSupportVertexWorld(Vector3d direction, out Vector3d vertex)
Parameters
directionVector3dvertexVector3d
Returns
TryGetTriangleVertices(int, out Vector3d, out Vector3d, out Vector3d)
Attempts to materialize one triangle's absolute world vertices. Canonical collision and query paths should consume scaled-local geometry instead.
public bool TryGetTriangleVertices(int index, out Vector3d first, out Vector3d second, out Vector3d third)
Parameters
indexintfirstVector3dsecondVector3dthirdVector3d
Returns
TryGetVertexWorld(int, out Vector3d)
Attempts to materialize one scaled vertex in world space.
public bool TryGetVertexWorld(int index, out Vector3d vertex)
Parameters
indexintvertexVector3d
Returns
UpdatePosition(Vector3d, FixedQuaternion)
Updates the mesh world-space position and rigid rotation.
public void UpdatePosition(Vector3d position, FixedQuaternion rotation)
Parameters
positionVector3drotationFixedQuaternion
UpdateTransform(Vector3d, FixedQuaternion, Vector3d)
Updates the mesh center, normalized rigid rotation, and strictly positive authored scale.
public void UpdateTransform(Vector3d position, FixedQuaternion rotation, Vector3d scale)
Parameters
positionVector3drotationFixedQuaternionscaleVector3d