From b86121869dbce2765a70b4893b4cca5072f5262e Mon Sep 17 00:00:00 2001 From: Winson Han Date: Fri, 13 Sep 2024 13:19:26 -0700 Subject: [PATCH] addressing comments - removing extra inverse matrix operations --- unity/Assets/Scripts/AgentManager.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/unity/Assets/Scripts/AgentManager.cs b/unity/Assets/Scripts/AgentManager.cs index 79f7f69588..712c9497de 100644 --- a/unity/Assets/Scripts/AgentManager.cs +++ b/unity/Assets/Scripts/AgentManager.cs @@ -624,10 +624,10 @@ private void updateCameraProperties( camera.transform.localScale = Vector3.one; } else { if (position.HasValue) { - camera.gameObject.transform.position = position.Value; + camera.transform.position = position.Value; } if (rotation.HasValue) { - camera.gameObject.transform.eulerAngles = rotation.Value; + camera.transform.eulerAngles = rotation.Value; } } @@ -1311,14 +1311,11 @@ bool shouldRenderImageSynthesis cMetadata.parentObjectName = camera.transform.parent.name; cMetadata.parentPositionRelativeThirdPartyCameraPosition = - camera.transform.parent.InverseTransformPoint(camera.transform.position); + camera.transform.localPosition; //get third party camera rotation as quaternion in parent space - var parentSpaceCameraRotationAsQuaternion = - Quaternion.Inverse(camera.transform.parent.rotation) - * worldSpaceCameraRotationAsQuaternion; cMetadata.parentPositionRelativeThirdPartyCameraRotation = - parentSpaceCameraRotationAsQuaternion.eulerAngles; + camera.transform.localEulerAngles; } else { cMetadata.parentObjectName = ""; cMetadata.parentPositionRelativeThirdPartyCameraPosition = null; @@ -1330,7 +1327,7 @@ bool shouldRenderImageSynthesis GameObject agent = camera.GetComponentInParent().gameObject; cMetadata.agentPositionRelativeThirdPartyCameraPosition = - agent.transform.InverseTransformPoint(camera.gameObject.transform.position); + agent.transform.InverseTransformPoint(camera.transform.position); var agentSpaceCameraRotationAsQuaternion = Quaternion.Inverse(agent.transform.rotation)