## c # – Unit: animation & # 39; Quaternion.RotateTowards & # 39; it is too fast (instantaneous)

I have a 'block' scenario on a hinge & # 39; where I just want it to turn smoothly to the position of a step. I got into this for a day and finally verified that my start and end angles are correct. The problem now is that the rotation animation is instantaneous rather than smooth over time. How can I adjust this so that the rotation takes about 2 seconds? Connect this to the argument & # 39; maxDegreesDelta & # 39; He felt intuitive but did nothing at all:

``````endAngle * Time.deltaTime / 2.0f
``````

See the documentation

The block itself is linked to this vacuum (location of the hinge):

The father of all the hinges is only 10 blocks in a row rotated by $$– arctan { left ( frac {4} {3} right)}$$ (so that's the angle to undo):

Here is the script:

``````using System.Collections;
using System.Collections.Generic;
using UnityEngine;

SpinningPublic class session: MonoBehaviour
{
[SerializeField]
GameObject triggerObj;
bool deactivated = false;
Quaternion startAngle;
Quaternion endAngle;
// Start is called before the first frame update
void Home ()
{
startAngle = transform.localRotation; // Right
Debug.Log (startAngle.eulerAngles);
endAngle = startAngle * Quaternion.Euler (Mathf.Rad2Deg * Mathf.Atan (4.0f / 3.0f), 0,0);
Debug.Log (endAngle.eulerAngles); // FINALLY correct!
}

// The update is called once per frame
Null update ()
{
disabled = GameObject.Find (triggerObj.name) .GetComponentInChildren().disabled;

yes (disabled)
{
gameObject.transform.rotation = Quaternion.RotateTowards (startAngle, endAngle, Time.deltaTime);
}
}
}
``````