Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class CameraController : MonoBehaviour
- {
- private float _path;
- [Range(5,10)]
- public float speed = 5;
- // Update is called once per frame
- void Update ()
- {
- _path = speed * Time.deltaTime;
- if (Input.GetKey(KeyCode.A))
- {
- transform.Translate(Vector3.left.normalized * _path);
- }
- if (Input.GetKey(KeyCode.D))
- {
- transform.Translate(Vector3.right.normalized * _path);
- }
- if (Input.GetKey(KeyCode.W))
- {
- transform.Translate(Vector3.up.normalized * _path);
- }
- if (Input.GetKey(KeyCode.S))
- {
- transform.Translate(Vector3.down.normalized * _path);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment