I came across a code that I guess is doing a pendulum camera, that's the class name. I would like to know the math behind that. I would like also to know how to decipher those stuff in game math, what are your recommendations ? I already own the book 3D Math for computer graphics by lengyel, but those stuff are not explained there.
Vector3 r = transform.right; Vector3 u = transform.up; Vector3 v = transform.forward; Vector3 dir = v + u * Mathf.Sin(Time.deltaTime * 0.01f) + r * Mathf.Sin(Time.deltaTime *0.01f + 0.1f) * -0.1f; dir.Normalize(); Quaternion rotation = Quaternion.identity; rotation.SetLookRotation(dir, Vector3.up); transform.rotation = rotation;