the walk manifold is alive
[carveJwlIkooP6JGAAIwe30JlM.git] / rigidbody.h
index 4318d8c1f294d117622c5421b840b239b2b74134..01734e8f2d74760ab32659165a1a51c633a4785c 100644 (file)
@@ -3,13 +3,15 @@
  *            qu3e  - Randy Gaul
  */
 
+#include "vg/vg.h"
+static void rb_tangent_basis( v3f n, v3f tx, v3f ty );
+
 #ifndef RIGIDBODY_H
 #define RIGIDBODY_H
 
 #define RB_DEPR 
 
-#include "vg/vg.h"
-#include "scene.h"
+#include "world.h"
 
 #define k_rb_delta (1.0f/60.0f)
 
@@ -106,7 +108,7 @@ static void rb_tangent_basis( v3f n, v3f tx, v3f ty )
    v3_cross( n, tx, ty );
 }
 
-static void rb_build_manifold( rigidbody *rb, scene *sc )
+static void rb_build_manifold( rigidbody *rb )
 {
    v3f *box = rb->bbx;
    v3f pts[8]; 
@@ -140,12 +142,16 @@ static void rb_build_manifold( rigidbody *rb, scene *sc )
       struct contact *ct = &rb->manifold[rb->manifold_count];
       
       v3f surface;
-
       v3_copy( point, surface );
+      surface[1] += 4.0f;
 
       ray_hit hit;
-      bvh_scene_sample( sc, surface, &hit );
+      hit.dist = INFINITY;
+      if( !ray_world( surface, (v3f){0.0f,-1.0f,0.0f}, &hit ))
+         continue;
+
       v3_copy( hit.normal, ct->n );
+      v3_copy( hit.pos, surface );
 
       float p = vg_minf( surface[1] - point[1], 1.0f );