module

Flock::Collision::Narrowphase3D

Exact shape-vs-shape tests in 3D. Each returns a Manifold3D? (nil when the shapes do not overlap); the normal points from A toward B. Orientations are passed explicitly (they live on RigidBody3D, not Transform3D).

Coverage: sphere / capsule pairs -> rounded cores (point/segment + radius) via closest-segment-segment. sphere-box -> closest point on the OBB. box-box -> SAT over 15 axes, single contact point. capsule-box -> approximate (closest point via clamp iteration; approximate minimum-translation push when the core segment penetrates the box).

Known v1 limitations: 3D manifolds are single-point (no face clipping), so resting box/capsule stacks are less stable than the 2D path; multi-point 3D manifold generation is a follow-up.

Constants

EPS = 1e-6_f32
FACE_BIAS = 0.005_f32

Box A vs box B via SAT (15 axes) with reference/incident face clipping for face contacts (up to 4 points) and a single point for edge-edge contacts. Normal A -> B.

Instance methods

capsule_obb(a0 : Flock::Vec3, a1 : Flock::Vec3, r : Float32, box : OBB3D) : Manifold3D | Nil

Capsule A (core a0..a1, radius r) vs box B. Approximate. Normal A -> B.

Source
collide(ca : Collider3D, pa : Flock::Vec3, qa : Flock::Quaternion, cb : Collider3D, pb : Flock::Vec3, qb : Flock::Quaternion) : ContactManifold3D | Nil
Source
obb_obb(a : OBB3D, b : OBB3D) : ContactManifold3D | Nil
Source
rounded_pair(a0 : Flock::Vec3, a1 : Flock::Vec3, ra : Float32, b0 : Flock::Vec3, b1 : Flock::Vec3, rb : Float32) : Manifold3D | Nil

Two rounded cores (sphere = degenerate point core). Normal A -> B.

Source
sphere_obb(spos : Flock::Vec3, r : Float32, box : OBB3D) : Manifold3D | Nil

Sphere A vs box B. Normal A -> B.

Source