I'm trying in my game to have camera rotation speed idependent of fps. For keyboard it works without problems but not for mouse movoment. At 60 fps it works good but at 200 for example rotation is to slow.
mouse_dif is difference since last frame in pixels. Maybe thats a problem too, bigger screen resolution will rotate faster then smaller.
My code:
const float rot_speed = u.GetRotationSpeed(); // returns 5.f
float val = 0;
if(allow_input == ALLOW_INPUT || allow_input == ALLOW_MOUSE)
val += float(mouse_dif.x)/200;
if(val > rot_speed*dt)
val = rot_speed*dt;
else if(val < -rot_speed*dt)
val = -rot_speed*dt;
u.rot += val;
How can I make it fps independent?