Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Unity Object rotation along any axis

using UnityEngine;
public class Rotation : MonoBehaviour
{
    public float xAngle, yAngle, zAngle;

    public GameObject objectToRotate;

    void Awake()
    {
   //change position here to see object as want
        objectToRotate.transform.position = new Vector3(0.1f, 0.0f, 0.0f);
        objectToRotate.transform.Rotate(90.0f, 0.0f, 0.0f, Space.Self);

    }

    void Update()
    {
        objectToRotate.transform.Rotate(xAngle, yAngle, zAngle, Space.Self);
     
    }
}
Source by # #
 
PREVIOUS NEXT
Tagged: #Unity #Object #rotation #axis
ADD COMMENT
Topic
Name
7+5 =