Struct Box
- Namespace
- Box3D
- Assembly
- Box3D.NET.dll
An axis-aligned box, described by its half-widths.
public readonly record struct Box : IEquatable<Box>Implements
Inherited Members
Examples
// A one metre cube.
body.AddBox(Box.Cube(0.5f));
// A ground slab: 100m across, 1m thick.
ground.AddBox(new Box(new Vector3(50.0f, 0.5f, 50.0f)));
Remarks
A box is a convex hull underneath. Unlike hulls built from arbitrary point clouds, a box is self-contained and costs nothing to create, so there is no resource to release.
Constructors
- Box(Vector3, Vector3)
-
Initializes a new instance of the Box3D.Box struct.
Properties
- Center
-
Gets the centre, relative to the body origin.
- HalfExtents
-
Gets the half-widths along each axis.
- Size
-
Gets the full size along each axis.
Methods
- Cube(float)
-
Creates a cube.
- FromSize(Vector3, Vector3)
-
Creates a box from its full size rather than its half-widths.