Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
- removing extra inverse matrix operations
  • Loading branch information
winthos committed Sep 13, 2024
1 parent ef3bfb2 commit b861218
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions unity/Assets/Scripts/AgentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -1330,7 +1327,7 @@ bool shouldRenderImageSynthesis
GameObject agent = camera.GetComponentInParent<BaseAgentComponent>().gameObject;

cMetadata.agentPositionRelativeThirdPartyCameraPosition =
agent.transform.InverseTransformPoint(camera.gameObject.transform.position);
agent.transform.InverseTransformPoint(camera.transform.position);

var agentSpaceCameraRotationAsQuaternion =
Quaternion.Inverse(agent.transform.rotation)
Expand Down

0 comments on commit b861218

Please sign in to comment.