- Home /
Independent Camera movement,Camera movement
Hello, I am looking for a tutorial/explanation on how to move the camera using arrow keys, I only need left and right. Every time I look online for a tutorial I keep finding how to get the camera to follow the player, but I don't want that, I want it to be independent and not follow anything.
Hope anyone can help!
Thanks
-Eben
Answer by dmitriy-untilov · Feb 19, 2018 at 02:30 PM
In the script attached to Camera write this: private float speed = 2.0f;
void Update () {
if (Input.GetKey(KeyCode.RightArrow)){
transform.position += Vector3.right * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.LeftArrow)){
transform.position += Vector3.left * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.UpArrow)){
transform.position += Vector3.forward * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.DownArrow)){
transform.position += Vector3.back * speed * Time.deltaTime;
}
}
http://coffeebreakcodes.com/move-zoom-and-rotate-camera-unity3d/
Your answer
Follow this Question
Related Questions
Regarding transform.position in the roll a ball tutorial 1 Answer
Making a bubble level (not a game but work tool) 1 Answer
UNITY 3D: How to make the camera follow the player? Smoothly 2 Answers
Mouse movement object in a straight line 2 Answers
How do I add a camera bounce effect every time the player lands? 0 Answers