Skip to content

cf_toi3

Category: collision
GitHub: cute_math3d.h


Computes the time of impact of two linearly moving 3d shapes.

CF_ToiResult3 cf_toi3(const void* A, CF_ShapeType3 typeA, CF_V3 vA, const void* B, CF_ShapeType3 typeB, CF_V3 vB, bool use_radius);
Parameters Description
A The first shape.
typeA The CF_ShapeType3 of the first shape A.
vA The velocity of A over the sweep.
B The second shape.
typeB The CF_ShapeType3 of the second shape B.
vB The velocity of B over the sweep.
use_radius True to use the radius of any CF_Sphere/CF_Capsule3 inputs, false to treat them as a point/segment.

Return Value

Returns a CF_ToiResult3; multiply the velocities by toi to move to the impact configuration.

Remarks

Same contract as the 2d cf_toi: no rotation over the sweep, and shapes that start out already touching report a miss with toi 1 -- sweep from a non-overlapping configuration (inflate radii slightly, resolve, then sweep).

CF_ToiResult3
CF_ShapeType3
cf_gjk3
cf_toi