So, is it ONLY used for physics objects, or there are exceptions?
Here, take this code that I made, where I try to rotate the camera around a cursor by 90 degrees after user input, for instance:
using UnityEngine;
using System.Collections;
public class CameraScript : MonoBehaviour {
public Transform cursor;
private bool rotate = false;
private float alreadyRotated = 0;
void Rotate () {
transform.RotateAround(cursor.position, Vector3.up, 90 * Time.deltaTime);
alreadyRotated += 90 * Time.deltaTime;
if(Mathf.Approximately(alreadyRotated, 90))
{
rotate = false;
alreadyRotated = 0;
}
}
void Start () {
transform.position = new Vector3(8, 3, 12);
transform.LookAt(cursor);
}
void Update () {
if(Input.GetKey("1"))
{
rotate = true;
}
}
void FixedUpdate () {
if(rotate)
Rotate();
}
}
I’m not dealing with physics here, right? If I do call this inside a Update(), however, the Camera never stops rotating, while inside a FixedUpdate() it does (this is what I want). I do get it, however, that this is because FixedUpdate gives me more precise results, but I was just questioning myself… Is it right to limit the use of FixedUpdate to RigidBody use, only? I’ve seen this being said more than a couple of times already…
Please enlighten me, guys!
Thanks