- Home /
How to reduce rotation speed of an object below 1?
Hey guys, so I'm trying to learn the basics and this youtube video had me use this code to create a spinning coin. I copied it and now the coin rotates but I feel like it is rotating much faster than on the video and more importantly, faster than I want. Can someone please explain how to make it slower than 1?
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CoinRotation: MonoBehaviour { public int rotateSpeed = 1; void Update() { transform.Rotate(0, rotateSpeed, 0, Space.World); } }
Answer by DenisIsDenis · Jun 03, 2021 at 02:53 AM
Corrected script:
using UnityEngine;
public class CoinRotation : MonoBehaviour {
public float rotateSpeed = 1; // The number of revolutions per second of the coin
void Update()
{
transform.Rotate(0, rotateSpeed * Time.deltaTime * 360, 0, Space.World);
}
}
Using Time.deltatime allows you to rotate the object regardless of the number of frames per second. "360" means that with a rotateSpeed of 1, the coin will rotate at a speed of 1 revolution per second.
Your answer
![](https://koobas.hobune.stream/wayback/20220613034526im_/https://answers.unity.com/themes/thub/images/avi.jpg)