a71806ccab935a1eba73743b41dce46ea0243455
3 #include "vg/vg_rigidbody.h"
4 #include "vg/vg_input.h"
5 #include "scene_rigidbody.h"
13 .box
= {{ -0.1f
, -0.2f
, -0.1f
},
14 { 0.1f
, 1.0f
, 0.1f
}},
17 static void testing_update(void){
18 if( !vg_console
.cheats
)
21 if( vg_getkey( SDLK_9
) ){
22 v3_add( localplayer
.rb
.co
, (v3f
){0,1,0}, baller
.rb
.co
);
23 v3_zero( baller
.rb
.w
);
24 v3_zero( baller
.rb
.v
);
25 q_identity( baller
.rb
.q
);
26 rb_update_matrices( &baller
.rb
);
29 if( vg_getkey( SDLK_8
) ){
30 localplayer
.have_glider
= 1;
31 localplayer
.glider_orphan
= 0;
32 player_glide
.t
= -1.0f
;
35 vg_line_boxf_transformed( baller
.rb
.to_world
, baller
.box
, VG__RED
);
37 world_instance
*world
= world_current_instance();
39 rigidbody _null
= {0};
40 _null
.inv_mass
= 0.0f
;
41 m3x3_zero( _null
.iI
);
44 rb_ct
*buf
= rb_global_buffer();
45 rb_contact_count
+= rb_box__scene( baller
.rb
.to_world
, baller
.box
,
46 NULL
, world
->geo_bh
, buf
,
47 k_material_flag_ghosts
);
48 for( u32 j
=0; j
<rb_contact_count
; j
++ ){
49 buf
[j
].rba
= &baller
.rb
;
53 rb_presolve_contacts( rb_contact_buffer
,
54 vg
.time_fixed_delta
, rb_contact_count
);
56 for( u32 i
=0; i
<8; i
++ )
57 rb_solve_contacts( rb_contact_buffer
, rb_contact_count
);
59 rb_iter( &baller
.rb
);
60 rb_update_matrices( &baller
.rb
);
63 static void testing_init(void){
64 rb_setbody_box( &baller
.rb
, baller
.box
, 8.0f
, 1.0f
);