|
I am trying to create a simple RTS camera that scrolls when the mouse is at the edges of the screen, here is my code: I want the camera to come to a smooth halt when the mouse moves away from the screen bounds, but the "damping" method I have implemented above doesn't seem to work. Does anyone know what I am doing wrong?
(comments are locked)
|
|
I've seen it somewhere: if ( Input.GetKey("d") || Input.mousePosition.x >= Screen.width * (1 - ScrollEdge) ) { transform.Translate(Vector3.right * Time.deltaTime * ScrollSpeed); } else if ( Input.GetKey("a") || Input.mousePosition.x <= Screen.width * ScrollEdge ) { transform.Translate(Vector3.right * Time.deltaTime * -ScrollSpeed); }
(comments are locked)
|
