Interface IConvexShape
- Namespace
- BepuPhysics.Collidables
- Assembly
- BepuPhysics.dll
Defines functions available on all convex shapes. Convex shapes have no hollowed out regions; any line passing through a convex shape will never enter and exit more than once.
public interface IConvexShape : IShape
- Inherited Members
Methods
ComputeAngularExpansionData(out float, out float)
Computes information about how the bounding box should be expanded in response to angular velocity.
void ComputeAngularExpansionData(out float maximumRadius, out float maximumAngularExpansion)
Parameters
Remarks
This is typically used in the engine for predicting bounding boxes at the beginning of the frame. Velocities are used to expand the bounding box so that likely future collisions will be detected. Linear velocity expands the bounding box in a direct and simple way, but angular expansion requires more information about the shape. Imagine a long and thin capsule versus a sphere: high angular velocity may require significant expansion on the capsule, but spheres are rotationally invariant.
ComputeBounds(Quaternion, out Vector3, out Vector3)
Computes the bounding box of a shape given an orientation.
void ComputeBounds(Quaternion orientation, out Vector3 min, out Vector3 max)
Parameters
orientation
QuaternionOrientation of the shape to use when computing the bounding box.
min
Vector3Minimum corner of the bounding box.
max
Vector3Maximum corner of the bounding box.
ComputeInertia(float)
Computes the inertia for a body given a mass.
BodyInertia ComputeInertia(float mass)
Parameters
mass
floatMass to use to compute the body's inertia.
Returns
- BodyInertia
Inertia for the body.
Remarks
Note that the BodyInertia returned by this stores the inverse mass and inverse inertia tensor. This is because the most high frequency use of body inertia most naturally uses the inverse.
RayTest(in RigidPose, Vector3, Vector3, out float, out Vector3)
Tests a ray against the shape.
bool RayTest(in RigidPose pose, Vector3 origin, Vector3 direction, out float t, out Vector3 normal)
Parameters
pose
RigidPosePose of the shape during the ray test.
origin
Vector3Origin of the ray to test against the shape relative to the shape.
direction
Vector3Direction of the ray to test against the shape.
t
floatDistance along the ray direction to the hit point, if any, in units of the ray direction's length. In other words, hitLocation = origin + direction * t.
normal
Vector3Normal of the impact surface, if any.
Returns
- bool
True if the ray intersected the shape, false otherwise.