Created
August 25, 2021 20:30
-
-
Save MrMagicPenguin/47e1d673e40d1127b9995de65f402324 to your computer and use it in GitHub Desktop.
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
// Pan | |
if (Input.GetMouseButton(1)) // right click | |
{ | |
// Clamp bounds of *rig* | |
positionZ = Input.GetAxis("Mouse X") * moveSpeed; | |
positionY = -Input.GetAxis("Mouse Y") * moveSpeed; | |
// clamp position | |
newPosition.z += positionZ; | |
newPosition.y += positionY; | |
} | |
// Change position of camera | |
transform.position = cameraBB.ClosestPoint(newPosition); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment