+ if( v3_length2( s->state.up_dir ) > 0.001f ){
+
+ if( v4_length(s->state.smoothed_rotation) <= 0.1f ||
+ v4_length(s->state.smoothed_rotation) >= 1.1f ){
+ vg_warn( "FIX THIS! CARROT\n" );
+ v4_copy( player->rb.q, s->state.smoothed_rotation );
+ }
+ v4_lerp( s->state.smoothed_rotation, player->rb.q, 2.0f*vg.frame_delta,
+ s->state.smoothed_rotation );
+ q_normalize( s->state.smoothed_rotation );
+
+ v3f yaw_ref = {1.0f,0.0f,0.0f},
+ yaw_smooth = {1.0f,0.0f,0.0f};
+ q_mulv( player->rb.q, yaw_ref, yaw_ref );
+ q_mulv( s->state.smoothed_rotation, yaw_smooth, yaw_smooth );
+ m3x3_mulv( player->rb.to_local, yaw_smooth, yaw_smooth );
+ m3x3_mulv( player->rb.to_local, yaw_ref, yaw_ref );
+
+ float yaw_counter_rotate = v3_dot(yaw_ref,yaw_smooth);
+ yaw_counter_rotate = vg_clampf(yaw_counter_rotate,-1.0f,1.0f);
+ yaw_counter_rotate = acosf( yaw_counter_rotate );
+ yaw_counter_rotate *= 1.0f-s->blend_fly;
+