Hello! I have the object powered by physics. Object moves along the XZ plane. I'm writing a script for camera to follow this object, so camera stays at the specific point relative to object position and rotation (actually "behind" the object). Code (CSharp): using UnityEngine; using System.Collections; public class FollowCam : MonoBehaviour { public GameObject target; public float camDistance; private Vector3 camPos; public float camHeight; void LateUpdate() { float angle = (target.transform.rotation.eulerAngles.y * Mathf.Deg2Rad); float x = Mathf.Sin (angle); float z = Mathf.Cos (angle); camPos = new Vector3 (x, camHeight, z); camPos = camPos * -camDistance; transform.position = new Vector3 (camPos.x + target.transform.position.x,camHeight,camPos.z + target.transform.position.z); transform.LookAt(target.transform,Vector3.up); } } The problem I have is then object rotates more than 90 or 270 degrees along X axis, Im getting "opposite" camera position. ("in front of the obj") I see two options to deal with this problem: 1) Use quatrernions, but since my script based on angle along Y axis i need to get this from quaternion. Can I do that? 2) Tracking angle change and changeng the sign of camPos vector in line 14, but things like Code (CSharp): if (angle >= 270 || angle<= 90) {sign *=-1;} doesnt seem to work.