#include "addon.h"
#include "ent_tornado.c"
+#include "vg/vg_rigidbody.h"
+#include "scene_rigidbody.h"
+#include "player_glide.h"
static void player__skate_bind(void){
struct skeleton *sk = &localplayer.skeleton;
- rb_update_transform( &localplayer.rb );
+ rb_update_matrices( &localplayer.rb );
struct { struct skeleton_anim **anim; const char *name; }
bindings[] = {
* Does collision detection on a sphere vs world, and applies some smoothing
* filters to the manifold afterwards
*/
-static int skate_collide_smooth( m4x3f mtx, rb_sphere *sphere, rb_ct *man ){
+static int skate_collide_smooth( m4x3f mtx, f32 r, rb_ct *man ){
world_instance *world = world_current_instance();
int len = 0;
- len = rb_sphere__scene( mtx, sphere, NULL, &world->rb_geo.inf.scene, man,
+ len = rb_sphere__scene( mtx, r, NULL, world->geo_bh, man,
k_material_flag_walking );
for( int i=0; i<len; i++ ){
localplayer.rb.w );
state->flip_time += state->flip_rate * k_rb_delta;
- rb_update_transform( &localplayer.rb );
+ rb_update_matrices( &localplayer.rb );
}
static enum trick_type player_skate_trick_input(void){
m3x3_q( transfer, qtransfer );
q_mul( qtransfer, state->store_smoothed, state->smoothed_rotation );
q_normalize( state->smoothed_rotation );
- rb_update_transform( &localplayer.rb );
+ rb_update_matrices( &localplayer.rb );
if( end ){
state->activity = k_skate_activity_air;
if( button_down(k_srbind_use) && (v3_length2(state->trick_vel) < 0.01f) ){
localplayer.subsystem = k_player_subsystem_walk;
- if( state->activity <= k_skate_activity_air_to_grind ){
- localplayer.subsystem = k_player_subsystem_glide;
- player__begin_holdout( (v3f){0,0,0} );
+ if( (state->activity <= k_skate_activity_air_to_grind) &&
+ localplayer.have_glider ){
+ player_glide_transition( state->reverse < 0.0f );
return;
}
v3_add( localplayer.rb.co, cg_offset, localplayer.rb.co );
}
- rb_update_transform( &localplayer.rb );
+ rb_update_matrices( &localplayer.rb );
localplayer.rb.v[1] += -state->gravity_bias * player_skate.substep_delta;
player_skate.substep -= player_skate.substep_delta;
k_material_flag_walking ) != -1) )
{
v3_lerp( start_co, localplayer.rb.co, t, localplayer.rb.co );
- rb_update_transform( &localplayer.rb );
+ rb_update_matrices( &localplayer.rb );
player__dead_transition( k_player_die_type_head );
return;
m4x3f mtx;
m3x3_identity( mtx );
m4x3_mulv( localplayer.rb.to_world, wheels[i].pos, mtx[3] );
-
- rb_sphere collider = { .radius = wheels[i].radius };
rb_ct *man = &manifold[ manifold_len ];
- int l = skate_collide_smooth( mtx, &collider, man );
+ int l = skate_collide_smooth( mtx, wheels[i].radius, man );
if( l )
wheels[i].state = k_collider_state_colliding;
}
float grind_radius = k_board_radius * 0.75f;
- rb_capsule capsule = { .height = (k_board_length+0.2f)*2.0f,
- .radius=grind_radius };
+ rb_capsule capsule = { .h = (k_board_length+0.2f)*2.0f,
+ .r = grind_radius };
m4x3f mtx;
v3_muls( localplayer.rb.to_world[0], 1.0f, mtx[0] );
v3_muls( localplayer.rb.to_world[2], -1.0f, mtx[1] );
rb_ct *cman = &manifold[manifold_len];
- int l = rb_capsule__scene( mtx, &capsule, NULL, &world->rb_geo.inf.scene,
+ int l = rb_capsule__scene( mtx, &capsule, NULL, world->geo_bh,
cman, k_material_flag_walking );
/* weld joints */
manifold_len += l;
if( vg_lines.draw )
- vg_line_capsule( mtx, capsule.radius, capsule.height, VG__WHITE );
+ vg_line_capsule( mtx, capsule.r, capsule.h, VG__WHITE );
/* add limits */
if( state->activity >= k_skate_activity_grind_any ){
* regular dance; calculate velocity & total mass, apply impulse.
*/
- struct contact *ct = &manifold[i];
+ rb_ct *ct = &manifold[i];
v3f rv, delta;
v3_sub( ct->co, world_cog, delta );
v3f dt;
rb_depenetrate( manifold, manifold_len, dt );
v3_add( dt, localplayer.rb.co, localplayer.rb.co );
- rb_update_transform( &localplayer.rb );
+ rb_update_matrices( &localplayer.rb );
substep_count ++;
q_mul( transport_rotation, localplayer.rb.q, localplayer.rb.q );
q_mul( transport_rotation, state->smoothed_rotation,
state->smoothed_rotation );
- rb_update_transform( &localplayer.rb );
+ q_normalize( localplayer.rb.q );
+ q_normalize( state->smoothed_rotation );
+ rb_update_matrices( &localplayer.rb );
player__pass_gate( id );
}
static void player__skate_post_animate(void){
struct player_skate_state *state = &player_skate.state;
localplayer.cam_velocity_influence = 1.0f;
+ localplayer.cam_dist = 1.8f;
v3f head = { 0.0f, 1.8f, 0.0f };
m4x3_mulv( localplayer.final_mtx[ localplayer.id_head ],