Created
November 4, 2021 20:43
-
-
Save LaserKaspar/2f20358e89dfe672d0bc98cf072715bb to your computer and use it in GitHub Desktop.
(UnityEngine) Short and simple camera orbit script with zoom.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class MouseOrbit : MonoBehaviour | |
{ | |
public float sensivity; | |
// Update is called once per frame | |
void Update() | |
{ | |
transform.Rotate(0, Input.GetAxis("Mouse X") * sensivity, 0, Space.World); | |
transform.Rotate(-Input.GetAxis("Mouse Y") * sensivity, 0, 0, Space.Self); | |
transform.GetChild(0).Translate(0, 0, Input.mouseScrollDelta.y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment