1

I've done an if / else with the final position / rotation plus they never complete, how can I check this? stays like this

https://i.stack.imgur.com/3ADqz.gif

    if(head == false)
        cam.transform.position = Vector3.Lerp(cam.transform.position, PosicMin, Time.deltaTime * Speed);
    else {
        cam.transform.position = Vector3.Lerp(cam.transform.position, PosicMax, Time.deltaTime * Speed);
    }
    if(head == false)
        cam.transform.eulerAngles = Vector3.Lerp(cam.transform.rotation.eulerAngles, RotationMin, Time.deltaTime*Speed);
    else {
        cam.transform.eulerAngles = Vector3.Lerp(cam.transform.rotation.eulerAngles, RotationMax, Time.deltaTime*Speed);
    }
Nitecki
  • 21
  • 1
  • 7
  • hi again, edited post.I did not understand your second question. – Nitecki Feb 26 '19 at 05:32
  • @Nitecki DMGregory is saying to use Quaternion.Lerp instead of Vector3.Lerp and to use transform.rotation instead of transform.rotation.eulerAngles. This provides a much smoother rotation, and prevents gimbal lock – Alex F Feb 26 '19 at 06:11
  • sorry, I did not see any difference between the two with the naked eye, the quaternion is very difficult to use. even getting more error still persists. I did transform.rotation = Quaternion.lerp (RotMin, RotMax, Time.deltaTime * Speed) – Nitecki Feb 26 '19 at 16:53