Skip to content

Commit 5de0d70

Browse files
Don't use scale in MVP calculation (o3de#677)
Signed-off-by: Jan Hanca <[email protected]>
1 parent d2e4afd commit 5de0d70

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Gems/ROS2/Code/Source/Camera/CameraSensor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ namespace ROS2
169169
void CameraSensor::RequestFrame(
170170
const AZ::Transform& cameraPose, AZStd::function<void(const AZ::RPI::AttachmentReadback::ReadbackResult& result)> callback)
171171
{
172-
const AZ::Transform inverse = (cameraPose * AtomToRos).GetInverse();
172+
const AZ::Transform cameraPoseNoScaling =
173+
AZ::Transform::CreateFromQuaternionAndTranslation(cameraPose.GetRotation(), cameraPose.GetTranslation());
174+
const AZ::Transform inverse = (cameraPoseNoScaling * AtomToRos).GetInverse();
173175
m_view->SetWorldToViewMatrix(AZ::Matrix4x4::CreateFromQuaternionAndTranslation(inverse.GetRotation(), inverse.GetTranslation()));
174176

175177
AZ::Render::FrameCaptureOutcome captureOutcome;

Gems/ROS2/Code/Source/Lidar/LidarRaycaster.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ namespace ROS2
142142
auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get();
143143
auto requestResults = sceneInterface->QuerySceneBatch(m_sceneHandle, requests);
144144
AZ_Assert(requestResults.size() == rayDirections.size(), "Request size should be equal to directions size");
145-
const auto localTransform = lidarTransform.GetInverse();
145+
const auto localTransform =
146+
AZ::Transform::CreateFromQuaternionAndTranslation(lidarTransform.GetRotation(), lidarTransform.GetTranslation()).GetInverse();
146147
const float maxRange = m_addMaxRangePoints ? m_range : AZStd::numeric_limits<float>::infinity();
147148

148149
for (int i = 0; i < requestResults.size(); i++)

0 commit comments

Comments
 (0)