// Update is called once per frame void Update() { //Transform Local to World coordinates(WorldOrigin) Vector3 worldPos = TransformPoint.InverseTransformPointUnscaled(WorldOrigin.transform, cam.transform.position); camWorldTxt.text = worldPos.ToString(); }
/*! * \brief Save camero position to file * * Camera position in camera space is saved in CamLocalPosition.txt. Camera position in WorldOrigin space is saved in CamWorldPosition.txt. */ void Update() { timeLeft -= Time.deltaTime; if (timeLeft <= 0.0f) { Vector3 localCamPos = cam.transform.position; Vector3 worldCamPos = TransformPoint.InverseTransformPointUnscaled(transform, localCamPos); //!< Transform point from Camera space to WorldOrigin space. //save coordinates FileModifier.Save("CamPosition/CamLocalPosition.txt", localCamPos.ToString()); FileModifier.Save("CamPosition/CamWorldPosition.txt", worldCamPos.ToString()); timeLeft = 1.0f; } }