Question by 
               brunoenvia · Jul 10, 2021 at 12:21 PM · 
                c#unity 5camerarotationscripting problem  
              
 
              my camera is rotating on Z axis when i just set it on X and Y
i don't understand why my camer a is spinning on an axis i didn't set a value i've tried 2 ways and both of them rotate my camera on z axis having no idea how eulers or quaternions work don't help either
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using Cinemachine;
 
 public class CameraRotation : MonoBehaviour
 {
     public Camera gameCamera;
     public Vector3 euler;
     public FixedJoystick cameraJoystick;
     Quaternion targetRotation;
     public float rotationSpeed;
 
     // Start is called before the first frame update
     void Start()
     {
         euler = gameCamera.transform.localEulerAngles;
     }
 
     // Update is called once per frame
     void Update()
     {
         /*  euler = new Vector3(cameraJoystick.Horizontal, cameraJoystick.Vertical, 0) * rotationSpeed;        
           gameCamera.transform.Rotate(euler); */
 
         Quaternion targetRotation = Quaternion.Euler(cameraJoystick.Horizontal, cameraJoystick.Vertical, 0);
         gameCamera.transform.Rotate(targetRotation.eulerAngles, Space.World);
     }
 }
 
 
              
               Comment
              
 
               
              Your answer