vendredi 16 juillet 2021

How to set the speed of a randomly rotating object? Unity

I have a platform that must rotate simultaneously in x, y & z directions in a random order, the maximum degree measure of rotation of vectors x & z is 10 degrees, and rotation in the "y" direction is 360 degrees.

Here is the code:

using UnityEngine;

public class PlaneRotating : MonoBehaviour
{
    void Start() {
     
 }
    void Update()
    {
        Vector3 euler = transform.eulerAngles;
     euler.z = Random.Range(-10f, 10f);
     euler.y = Random.Range(0f, 360f);
     euler.x = Random.Range(-10f, 10f);
     transform.eulerAngles = euler;
    }
}

Everything works perfectly, except for a certain rotation speed, since I don't know how to set it.

Can you tell me how to set the speed?




Aucun commentaire:

Enregistrer un commentaire