Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

how to adjust the height of the camera to the terrain

$
0
0
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); }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>