- Home /
Orbit around an object
I want to create a camera moment that mimics the unity editor camera when you press "Alt"
my code is as follows: if (Input.GetKey (KeyCode.LeftAlt)) { if (Input.GetMouseButton (0)) {
                 axis = transform.TransformDirection(new Vector3 (-Input.GetAxis ("Mouse Y"), Input.GetAxis ("Mouse X"), 0));
 
                 transform.LookAt(center);
                 transform.RotateAround (center.position, axis, rotationSpeed * Time.deltaTime);
             
                 
             }
         }
This almost does the trick but it doesn't allow you to rotate the camera all the way around in the Y detection.
I am probably over looking something simple but I just cant figure it out .
Thank you for the help!
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Set Max Rotation On Weapon Sway 0 Answers
Mouse Orbit + Move Object + Follow Problem 1 Answer
Moving replacing center object with orbiting object 0 Answers
Camera Movement issue 1 Answer
Issue with Camera Tilt & Movement at the same time 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                