Hi i need suggestion i m trying to scroll my six game object horizontally, but i m unable to do can u suggest how to scroll game object in given window size.I m very thankful to you.
1 Answer
1Well the most obvious way is by moving the camera in the plane which faces your scene.
private var cameraTransform;
var speed = 2.0;
function Awake()
{
cameraTransform = Camera.main.transform;
}
function Update()
{
if(Input.GetKey("w"))
cameraTransform.position -= cameraTransform.right * speed;
if(Input.GetKey("e"))
cameraTransform.position += cameraTransform.right * speed;
if(Input.GetKey("s"))
cameraTransform.position -= cameraTransform.forward * speed;
if(Input.GetKey("x"))
cameraTransform.position += cameraTransform.forward * speed;
if(Input.GetKey("a"))
cameraTransform.position -= cameraTransform.up * speed;
if(Input.GetKey("z"))
cameraTransform.position += cameraTransform.up * speed;
}
Thanks for ur reply but i want scroll through touch and given window size.
– rakesh12Might have been worth mentioning that in your question then.
– whydoidoit