1 #ifndef PLAYER_COMMON_C
2 #define PLAYER_COMMON_C
6 void player_look( player_instance
*player
, v3f angles
)
9 v2_muladds( angles
, vg
.mouse_delta
, 0.0025f
, angles
);
11 if( vg_input
.controller_should_use_trackpad_look
)
13 static v2f last_input
;
15 static v2f vel_smooth
;
17 v2f input
= { player
->input_js2h
->axis
.value
,
18 player
->input_js2v
->axis
.value
};
20 if( (v2_length2(last_input
) > 0.001f
) && (v2_length2(input
) > 0.001f
) )
22 v2_sub( input
, last_input
, vel
);
23 v2_muls( vel
, 1.0f
/vg
.time_delta
, vel
);
30 v2_lerp( vel_smooth
, vel
, vg
.time_delta
*8.0f
, vel_smooth
);
32 v2_muladds( angles
, vel_smooth
, vg
.time_delta
, angles
);
33 v2_copy( input
, last_input
);
37 angles
[0] += player
->input_js2h
->axis
.value
* vg
.time_delta
* 4.0f
;
38 angles
[1] += player
->input_js2v
->axis
.value
* vg
.time_delta
* 4.0f
;
41 angles
[1] = vg_clampf( angles
[1], -VG_PIf
*0.5f
, VG_PIf
*0.5f
);
44 #endif /* PLAYER_COMMON_C */