/*
* Update world space bounding box based on local one
*/
-VG_STATIC void rb_update_bounds( rigidbody *rb )
-{
- box_copy( rb->bbx, rb->bbx_world );
- m4x3_transform_aabb( rb->to_world, rb->bbx_world );
+VG_STATIC void rb_update_bounds( rigidbody *rb ){
+ box_init_inf( rb->bbx_world );
+ m4x3_expand_aabb_aabb( rb->to_world, rb->bbx_world, rb->bbx );
}
/*
v3_copy( tn, ct->n );
if( v3_length2( ct->n ) <= 0.00001f ){
+#ifdef RIGIDBODY_CRY_ABOUT_EVERYTHING
vg_error( "Zero area triangle!\n" );
+#endif
return 0;
}
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 );
/* find best feature */
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;
}