3 #include "vg/vg_rigidbody.h"
4 #include "scene_rigidbody.h"
12 .box
= {{ -0.1f
, -0.2f
, -0.1f
},
13 { 0.1f
, 1.0f
, 0.1f
}},
16 static void testing_update(void){
17 if( vg_getkey( SDLK_9
) ){
18 v3_add( localplayer
.rb
.co
, (v3f
){0,1,0}, baller
.rb
.co
);
19 v3_zero( baller
.rb
.w
);
20 v3_zero( baller
.rb
.v
);
21 q_identity( baller
.rb
.q
);
22 rb_update_matrices( &baller
.rb
);
25 if( vg_getkey( SDLK_8
) ){
26 localplayer
.have_glider
= 1;
27 localplayer
.have_glider
= 0;
30 vg_line_boxf_transformed( baller
.rb
.to_world
, baller
.box
, VG__RED
);
32 world_instance
*world
= world_current_instance();
34 rigidbody _null
= {0};
35 _null
.inv_mass
= 0.0f
;
36 m3x3_zero( _null
.iI
);
39 rb_ct
*buf
= rb_global_buffer();
40 rb_contact_count
+= rb_box__scene( baller
.rb
.to_world
, baller
.box
,
41 NULL
, world
->geo_bh
, buf
,
42 k_material_flag_ghosts
);
43 for( u32 j
=0; j
<rb_contact_count
; j
++ ){
44 buf
[j
].rba
= &baller
.rb
;
48 rb_presolve_contacts( rb_contact_buffer
, rb_contact_count
);
50 for( u32 i
=0; i
<8; i
++ )
51 rb_solve_contacts( rb_contact_buffer
, rb_contact_count
);
53 rb_iter( &baller
.rb
);
54 rb_update_matrices( &baller
.rb
);
57 static void testing_init(void){
58 rb_setbody_box( &baller
.rb
, baller
.box
, 8.0f
, 1.0f
);