.co = {0.0f, 0.0f, 0.0f},
.q = {0.0f,0.0f,0.0f,1.0f},
.is_world = 1 };
+
+rigidbody blocky =
+ {
+ .type = k_rb_shape_box,
+ .bbx = {{-2.0f,-1.0f,-3.0f},{2.0f,1.0f,2.0f}},
+ .co = {30.0f,2.0f,30.0f},
+ .q = {0.0f,0.0f,0.0f,1.0f},
+ .is_world = 1
+ };
+
rigidbody funnel[4] = {
{
.type = k_rb_shape_box,
}
};
+rigidbody jeff1 = { .type = k_rb_shape_capsule,
+ .inf.capsule = { .radius = 0.75f, .height = 3.0f },
+ .co = {30.0f, 4.0f, 30.0f },
+ .q = {0.0f,0.0f,0.0f,1.0f}
+};
rigidbody ball = { .type = k_rb_shape_sphere,
.inf.sphere = { .radius = 2.0f },
rb_init( &ground );
rb_init( &ball );
rb_init( &ball1 );
+ rb_init( &jeff1 );
+ rb_init( &blocky );
}
static void physics_test_update(void)
rb_iter( &ball );
rb_iter( &ball1 );
+ rb_iter( &jeff1 );
rb_solver_reset();
rb_contact_count += rb_sphere_vs_box( &ball1, &ground, rb_global_ct() );
rb_contact_count += rb_sphere_vs_sphere( &ball, &ball1, rb_global_ct() );
- rb_presolve_contacts();
+ rb_contact_count += rb_capsule_vs_box( &jeff1, &ground, rb_global_ct() );
+ rb_contact_count += rb_capsule_vs_box( &jeff1, &blocky, rb_global_ct() );
+
+ rb_presolve_contacts( rb_contact_buffer, rb_contact_count );
for( int i=0; i<5; i++ )
- rb_solve_contacts();
+ rb_solve_contacts( rb_contact_buffer, rb_contact_count );
rb_update_transform( &ball );
rb_update_transform( &ball1 );
+ rb_update_transform( &jeff1 );
}
if(glfwGetKey( vg_window, GLFW_KEY_L ))
{
- v3_copy( player.camera_pos, ball.co );
- v3_zero( ball.v );
- v3_zero( ball.w );
+ v3_copy( player.camera_pos, jeff1.co );
+ v3_zero( jeff1.v );
+ v3_zero( jeff1.w );
}
for( int i=0; i<4; i++ )
rb_debug( &ground, 0xff00ff00 );
rb_debug( &ball, 0xffe00040 );
rb_debug( &ball1, 0xff00e050 );
+
+ rb_debug( &blocky, 0xffcccccc );
+ rb_debug( &jeff1, 0xff00ffff );
}
static void physics_test_render(void)
m4x4f world_4x4;
m4x3_expand( player.camera_inverse, world_4x4 );
- gpipeline.fov = freecam? 60.0f: 135.0f; /* 120 */
+ gpipeline.fov = 60.0f;
m4x4_projection( vg_pv, gpipeline.fov,
(float)vg_window_x / (float)vg_window_y,
0.1f, 2100.0f );