len += rb_sphere_vs_scene( rbf, &world.rb_geo, manifold+len );
len += rb_sphere_vs_scene( rbb, &world.rb_geo, manifold+len );
-#if 0
- for( int i=0; i<len; i++ )
- {
- u32 *ptri = &world.geo.indices[ geo[i]*3 ];
-
- for( int j=0; j<3; j++ )
- v3_copy( world.geo.verts[ptri[j]].co, tri[j] );
-
- vg_line(tri[0],tri[1],0xff00ff00 );
- vg_line(tri[1],tri[2],0xff00ff00 );
- vg_line(tri[2],tri[0],0xff00ff00 );
-
- v3f temp;
- v3_copy( player.rb.co, temp );
-
- for( int j=0; j<2; j++ )
- {
- if(manifold_count >= vg_list_size(manifold))
- {
- vg_error("Manifold overflow!\n");
- break;
- }
-
- rb_ct *ct = &manifold[manifold_count];
- v3_copy( poles[j], player.rb.co );
-
- manifold_count += rb_sphere_vs_triangle( &player.rb, tri, ct );
- }
-
- v3_copy( temp, player.rb.co );
- }
-#endif
-
rb_presolve_contacts( manifold, len );
v3f surface_avg = {0.0f, 0.0f, 0.0f};
else
{
for( int i=0; i<len; i++ )
+ {
v3_add( manifold[i].n, surface_avg, surface_avg );
+ if( manifold[i].element_id <= world.sm_geo_std_oob.vertex_count )
+ {
+ player.is_dead = 1;
+ character_ragdoll_copypose( &player.mdl, player.rb.v );
+ return;
+ }
+ }
+
v3_normalize( surface_avg );
if( v3_dot( player.rb.v, surface_avg ) > 0.5f )