- Home /
Rotating Camera around player object
Hello, I'm fairly new to Unity and only just really learning to code. I'm trying to copy the rotation of the player object along the x-axis and apply it to rotation around it by the camera. Because the player object already rotates using the x-axis of the mouse the idea behind this was to make the camera and the object rotate using the mouse.
Here's what I have so far but it's not working (the main issue being that copying the rotation of the player object is a float value which doesn't convert into a vector3 for the transform):
     void Start()
     {
     transform.LookAt(player.transform.position);
     offset = transform.position - player.transform.position;
     }
 // Update is called once per frame
 void LateUpdate()
     {
     float axisHorizontal = Input.GetAxis("Mouse X");
     Vector3 AxisRotation = new Vector3(0.0f, axisHorizontal, 0.0f);
     transform.position = player.transform.position + offset;
     transform.RotateAround(player.transform.position, player.transform.localRotation.eulerAngles.x, cameraSpeed * Time.deltaTime);
         
     }
Any ideas how to fix this?
Your answer
 
 
             Follow this Question
Related Questions
How to keep the player on the left side o the screen? 2 Answers
Flip over an object (smooth transition) 3 Answers
How to make Camera position Independent of its Rotation? 1 Answer
Moving Camera on player stop then move and rotate to separate point? 0 Answers
Player rotation = Camera Rotation 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                