Hey guys,
I’ve been working on a weapon system for a while as a learning exercise. Ive come across a small issue. After reading the Script Reference on Input.GetAxis(…) it says it is already framerate independent and does not need to be multiplied by Time.deltaTime. The issue im getting is that whether I multiply it by Time.deltaTime or not it is still getting effected by the framerate.
This is a barebones version of my weapon sway function which is called from the Update function.
mouse_x = Input.GetAxis("Mouse X") * moveAmount;
mouse_y = Input.GetAxis("Mouse Y") * moveAmount;
Vector3 target = new Vector3(currentPosition.x + mouse_x, currentPosition.y + (mouse_y * 0.2f), currentPosition.z);
transform.localPosition = Vector3.Lerp(transform.localPosition, target, smoothSpeed * Time.deltaTime);
I have also made a small demo showing the effect. (Press F1 - F4 to lock the framerate at different amounts)
https://dl.dropboxusercontent.com/u/108986232/Win32.zip
Script Reference page.
Ive been scratching my head on this for a while and would greatly appreciate any help you guys can give me or tell me i’m stupid and missing something. (Probably the case
)
Cheers
- Matt