- Home /
 
 
               Question by 
               Trild123787898 · Dec 30, 2019 at 07:40 PM · 
                rotationtransformobject  
              
 
              rotation of the object to a given angle
I have an object which, when I press the key, I must rotate along the And axis by 30 degrees, and do not rotate anymore
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by xibanya · Dec 30, 2019 at 08:18 PM
I may need more information, but have you tried Quaternion.AngleAxis?
From the link:
 using UnityEngine;
 public class Example : MonoBehaviour
 {
     void Start()
     {
         // Sets the transform's current rotation to a new rotation that rotates 30 degrees around the y-axis(Vector3.up)
         transform.rotation = Quaternion.AngleAxis(30, Vector3.up);
     }
 }
 
              Your answer