можь у кого йесть идеи?
Синтаксис:
Используется csharp
IEnumerator RotateCannonOverTime()
{
Quaternion from = transform.rotation;
Quaternion to = Quaternion.Euler(0, 0, from.eulerAngles.z + cannonRotateDegree);
//print("transform.rotation " + transform.rotation);
//print("to" + to);
float totaltime = 0f;
while (true)
{
print("transform.rotation " + transform.rotation);
totaltime += Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, to, cannonRotateTime);
if (totaltime >= cannonRotateTime)
{
cannonRotateDegree *= (-1);
break;
}
yield return new WaitForFixedUpdate();
}
}
{
Quaternion from = transform.rotation;
Quaternion to = Quaternion.Euler(0, 0, from.eulerAngles.z + cannonRotateDegree);
//print("transform.rotation " + transform.rotation);
//print("to" + to);
float totaltime = 0f;
while (true)
{
print("transform.rotation " + transform.rotation);
totaltime += Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, to, cannonRotateTime);
if (totaltime >= cannonRotateTime)
{
cannonRotateDegree *= (-1);
break;
}
yield return new WaitForFixedUpdate();
}
}