i know how to rotate the object
if (Input.GetKeyDown (KeyCode.T)) {
transform.Rotate (0, 180, 0);
}
but i want it to rotate slowly
please help
thanks in advance
i know how to rotate the object
if (Input.GetKeyDown (KeyCode.T)) {
transform.Rotate (0, 180, 0);
}
but i want it to rotate slowly
please help
thanks in advance
Try:
float speed = 10F; transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, 180, 0), Time.deltaTime * speed);
The main part here is Time.deltaTime * speed that will take the time into account to rotate your object. You can adjust the rotation speed by modifying the value of speed .
You can use:
transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(0, 180, 0), speed * Time.deltaTime);
You could create a new animation and adjust the keyframes to how slow you want it to be, instead of messing with the speed of actual time.