Question by 
               PigChop · Jul 10, 2017 at 10:50 PM · 
                rotationbugwhats-wrong  
              
 
              WHAT THE HECK? Rotations not working.
Ive been tearing my hair out over this. I feel so stupid. Whats wrong with this script: (It looks terrible right now cause this is my 50th idea so its not even trying optimization)
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CamScript : MonoBehaviour {
 float sensitivity;
 public Vector2 clampVals;
 // Use this for initialization
 void Start () {
     sensitivity = gameObject.transform.root.GetComponent<PlayerController>().sensitivity;
     lastRo = transform.localEulerAngles.x;
 }
 public float lastRo;
 void Update () {
     lastRo -= Input.GetAxis("Mouse Y") * sensitivity * Time.deltaTime;
     lastRo = Mathf.Clamp(lastRo, clampVals.x, clampVals.y);
     Quaternion ro = transform.localRotation;
     ro.x = lastRo;
     Debug.Log(ro.x);
     transform.localRotation = ro;
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Quaternion.FromToRotation - is it a bug? Possible workarounds? 1 Answer
When exporting from Blender, animation gets messed up 0 Answers
Very basic rotation BUG. transform.up = transform.up sets Y rotation to 0. 1 Answer
2d Animation, Rotating GameObject bug 1 Answer
Trouble with rotating player when gravity is shifted 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                