public static void SetCameraPose(Camera cam, CameraPose pose) { cam.transform.position = pose.position; cam.transform.localRotation = Quaternion.Euler(pose.rotation); cam.nearClipPlane = pose.nearClip; cam.farClipPlane = pose.farClip; cam.fieldOfView = pose.fov; }
void Move(string message) { // Deserialize the proto. CameraPose pose = CameraPose.Parser.ParseFrom(Convert.FromBase64String(message)); // Update the camera's position and rotation. position.Set(pose.PositionX, pose.PositionY, pose.PositionZ); rotation.Set(pose.RotationX, pose.RotationY, pose.RotationZ, pose.RotationW); }
public static CameraPose GetCameraPose(Camera cam) { CameraPose pose = new CameraPose(); pose.position = cam.transform.position; pose.rotation = cam.transform.localRotation.eulerAngles; pose.nearClip = cam.nearClipPlane; pose.farClip = cam.farClipPlane; pose.fov = cam.fieldOfView; return(pose); }