+
+ v3f v0, v1, n;
+ v3_sub( tri[1], tri[0], v0 );
+ v3_sub( tri[2], tri[0], v1 );
+ v3_cross( v0, v1, n );
+
+ if( v3_length2( n ) <= 0.00001f ){
+#ifdef RIGIDBODY_CRY_ABOUT_EVERYTHING
+ vg_error( "Zero area triangle!\n" );
+#endif
+ return 0;
+ }
+
+ v3_normalize( n );
+
+#if 1
+ /* deep penetration recovery. for when we clip through the triangles. so its
+ * not very 'correct' */
+ f32 dist;
+ if( ray_tri( tri, p0w, mtxA[1], &dist, 1 ) ){
+ f32 l = c->height - c->radius*2.0f;
+ if( (dist >= 0.0f) && (dist < l) ){
+ v3f co;
+ v3_muladds( p0w, mtxA[1], dist, co );
+ vg_line_point( co, 0.02f, 0xffffff00 );
+
+ v3f d0, d1;
+ v3_sub( p0w, co, d0 );
+ v3_sub( p1w, co, d1 );
+
+ f32 p = vg_minf( v3_dot( n, d0 ), v3_dot( n, d1 ) ) - c->radius;
+
+ rb_ct *ct = buf;
+ ct->p = -p;
+ ct->type = k_contact_type_default;
+ v3_copy( n, ct->n );
+ v3_muladds( co, n, p, ct->co );
+
+ return 1;
+ }
+ }
+#endif