hi guys. I am currently working an rts game.as of now my camera moves when the mouse pointer is scrolling but the problem is that the environment that i am using is a dessert in which the ground is uneven. Can you please tell me how the height of my camera would adjust to my terrain?
The code that i am using is this.
if (mousePosX < scrollDistance)
{
transform.Translate(Vector3.right * -scrollSpeed * Time.deltaTime);
}
if (mousePosX >= Screen.width - scrollDistance)
{
transform.Translate(Vector3.right * scrollSpeed * Time.deltaTime);
}
if (mousePosY < scrollDistance)
{
transform.Translate(transform.forward * -scrollSpeed * Time.deltaTime);
}
if (mousePosY >= Screen.height - scrollDistance)
{
transform.Translate(transform.forward * scrollSpeed * Time.deltaTime);
}
↧