+
+ struct player_board *board = player->board;
+
+ if( board ){
+ /* foot weight distribution */
+ if( s->blend_weight > 0.0f ){
+ kf_foot_l->co[2] =
+ vg_lerpf( kf_foot_l->co[2],
+ board->truck_positions[k_board_truck_back][2]+0.3f,
+ 0.5f*s->blend_weight );
+ }
+ else{
+ kf_foot_r->co[2] =
+ vg_lerpf( kf_foot_r->co[2],
+ board->truck_positions[k_board_truck_front][2]-0.3f,
+ -0.5f*s->blend_weight );
+ }
+ }
+
+ float slapm = vg_maxf( 1.0f-v3_length2( s->state.trick_vel ), 0.0f );
+ s->subslap = vg_lerpf( s->subslap, slapm, vg.time_delta*10.0f );
+
+ kf_foot_l->co[1] += s->state.slap;
+ kf_foot_r->co[1] += s->state.slap;
+ kf_knee_l->co[1] += s->state.slap;
+ kf_knee_r->co[1] += s->state.slap;
+ kf_board->co[1] += s->state.slap * s->subslap;
+ kf_hip->co[1] += s->state.slap * 0.25f;
+
+ /*
+ * animation wishlist:
+ * boardslide/grind jump animations
+ * when tricking the slap should not appply or less apply
+ * not animations however DONT target grinds that are vertically down.
+ */
+
+ /* truck rotation */
+ for( int i=0; i<2; i++ )
+ {
+ float a = vg_minf( s->truckv0[i][0], 1.0f );
+ a = -acosf( a ) * vg_signf( s->truckv0[i][1] );
+
+ v4f q;
+ q_axis_angle( q, (v3f){0.0f,0.0f,1.0f}, a );
+ q_mul( q, kf_wheels[i]->q, kf_wheels[i]->q );
+ q_normalize( kf_wheels[i]->q );
+ }
+ }
+
+ {
+ mdl_keyframe
+ *kf_head = &dest->pose[av->id_head-1],
+ *kf_elbow_l = &dest->pose[av->id_ik_elbow_l-1],
+ *kf_elbow_r = &dest->pose[av->id_ik_elbow_r-1],
+ *kf_hand_l = &dest->pose[av->id_ik_hand_l-1],
+ *kf_hand_r = &dest->pose[av->id_ik_hand_r-1];
+
+ float warble = perlin1d( vg.time, 2.0f, 2, 300 );
+ warble *= vg_maxf(s->blend_grind,fabsf(s->blend_weight)) * 0.3f;
+
+ v4f qrot;
+ q_axis_angle( qrot, (v3f){0.8f,0.7f,0.6f}, warble );
+
+ v3f origin = {0.0f,0.2f,0.0f};
+ keyframe_rotate_around( kf_hand_l, origin,
+ av->sk.bones[av->id_ik_hand_l].co, qrot );
+ keyframe_rotate_around( kf_hand_r, origin,
+ av->sk.bones[av->id_ik_hand_r].co, qrot );
+ keyframe_rotate_around( kf_hip, origin,
+ av->sk.bones[av->id_hip].co, qrot );
+ keyframe_rotate_around( kf_elbow_r, origin,
+ av->sk.bones[av->id_ik_elbow_r].co, qrot );
+ keyframe_rotate_around( kf_elbow_l, origin,
+ av->sk.bones[av->id_ik_elbow_l].co, qrot );
+
+ q_inv( qrot, qrot );
+ q_mul( qrot, kf_head->q, kf_head->q );
+ q_normalize( kf_head->q );