- Home /
Question by
Ramulen · Dec 13, 2015 at 02:52 PM ·
camera-movementkeyboardstutter
Smooth scrolling works with pad but not with keyboard
Hi community,
I got a strange issue and cant find the source for it.
i would like to scroll/move the camera with the keyboard (WASD). The following code works smooth, if i use a gamepad for moving the camera. If I use the keyboard (WASD) it's smooth for around 0,5 seconds, than it starts to stutter.
Here is the Code I use:
void Update () {
// Move camera via WASD/Pad
float xAxisValue = Input.GetAxis("Horizontal");
float zAxisValue = Input.GetAxis("Vertical");
if (Camera.current != null)
{
transform.position += Vector3.left * xAxisValue * Time.deltaTime * moveSpeed;
transform.position += Vector3.back * zAxisValue * Time.deltaTime * moveSpeed;
}
}
Hope you can help me out here.
Comment