module

Flock::Collision::Solver3D

Warm-started sequential-impulse solver in 3D. Same idea as Solver2D but with a two-axis friction basis clamped to the friction cone, and the world inverse inertia applied via q * (Ibody^-1 * (q^-1 * w)).

Constants

CORRECTION_PERCENT = 0.4_f32
PENETRATION_SLOP = 0.005_f32
RESTITUTION_THRESHOLD = 0.5_f32

Instance methods

build_constraint(i : Int32, j : Int32, key : UInt64, a : RigidBody3D, pa : Flock::Vec3, b : RigidBody3D, pb : Flock::Vec3, m : Manifold3D) : ContactConstraint3D
Source
correct_position(pa : Flock::Vec3, inv_ma : Float32, pb : Flock::Vec3, inv_mb : Float32, m : Manifold3D, weight : Float32 = 1.0_f32) : Tuple(Flock::Vec3, Flock::Vec3)

weight scales the correction so a multi-point manifold (each point corrected separately) sums to at most ~1x — pass 1/point_count.

Source
match_cache(cached : Array(CachedImpulse3D) | Nil, point : Flock::Vec3) : Tuple(Float32, Float32, Float32)
Source
pair_key(a : Flock::Entity, b : Flock::Entity) : UInt64
Source
solve_constraint(a : RigidBody3D, b : RigidBody3D, c : ContactConstraint3D) : Tuple(RigidBody3D, RigidBody3D, ContactConstraint3D)
Source
warm_start(a : RigidBody3D, b : RigidBody3D, c : ContactConstraint3D) : Tuple(RigidBody3D, RigidBody3D)
Source