+static void rb_box_incident_dir( v3f p, boxf box, v3f dir )
+{
+
+}
+
+/*
+ * Generates up to two contacts; optimised for the most stable manifold
+ */
+static int rb_capsule_vs_box( rigidbody *rba, rigidbody *rbb, rb_ct *buf )
+{
+ float h = rba->inf.capsule.height,
+ r = rba->inf.capsule.radius;
+
+ v3f p0, p1;
+ v3_muladds( rba->co, rba->up, h*0.5f-r*0.5f, p1 );
+ v3_muladds( rba->co, rba->up, -h*0.5f+r*0.5f, p0 );
+
+ m4x3_mulv( rbb->to_local, p0, p0 );
+ m4x3_mulv( rbb->to_local, p1, p1 );
+
+ /* Clip zone +y */
+
+ v3f c0, c1;
+ closest_point_aabb( p0, rbb->bbx, c0 );
+ closest_point_aabb( p1, rbb->bbx, c1 );
+
+ v3f vis0;
+ m4x3_mulv( rbb->to_world, c0, vis0 );
+ vg_line_pt3( vis0, 0.1f, 0xffff00ff );
+ m4x3_mulv( rbb->to_world, c1, vis0 );
+ vg_line_pt3( vis0, 0.1f, 0xffff00ff );
+
+ v3f d0, d1;
+ v3_sub( p0, c0, d0 );
+ v3_sub( p1, c1, d1 );
+
+ float d02 = v3_length2(d0),
+ d12 = v3_length2(d1);
+
+ int count = 0;
+
+ if( d02 <= r*r )
+ {
+ rb_ct *ct = buf+count;
+ float d = sqrtf(d02);
+
+ vg_info( "d: %.4f\n", d );
+
+ v3_muls( d0, -1.0f/d, ct->n );
+ ct->p = r-d;
+ v3_add( c0, p0, ct->co );
+ v3_muls( ct->co, 0.5f, ct->co );
+
+ m3x3_mulv( rbb->to_world, ct->n, ct->n );
+ m4x3_mulv( rbb->to_world, ct->co, ct->co );
+
+ ct->rba = rba;
+ ct->rbb = rbb;
+ count ++;
+ }
+
+ return count;
+}
+