Skip to content

Commit

Permalink
Don't use scale in MVP calculation (o3de#677)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Hanca <[email protected]>
  • Loading branch information
jhanca-robotecai authored Mar 28, 2024
1 parent d2e4afd commit 5de0d70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Gems/ROS2/Code/Source/Camera/CameraSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ namespace ROS2
void CameraSensor::RequestFrame(
const AZ::Transform& cameraPose, AZStd::function<void(const AZ::RPI::AttachmentReadback::ReadbackResult& result)> callback)
{
const AZ::Transform inverse = (cameraPose * AtomToRos).GetInverse();
const AZ::Transform cameraPoseNoScaling =
AZ::Transform::CreateFromQuaternionAndTranslation(cameraPose.GetRotation(), cameraPose.GetTranslation());
const AZ::Transform inverse = (cameraPoseNoScaling * AtomToRos).GetInverse();
m_view->SetWorldToViewMatrix(AZ::Matrix4x4::CreateFromQuaternionAndTranslation(inverse.GetRotation(), inverse.GetTranslation()));

AZ::Render::FrameCaptureOutcome captureOutcome;
Expand Down
3 changes: 2 additions & 1 deletion Gems/ROS2/Code/Source/Lidar/LidarRaycaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ namespace ROS2
auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get();
auto requestResults = sceneInterface->QuerySceneBatch(m_sceneHandle, requests);
AZ_Assert(requestResults.size() == rayDirections.size(), "Request size should be equal to directions size");
const auto localTransform = lidarTransform.GetInverse();
const auto localTransform =
AZ::Transform::CreateFromQuaternionAndTranslation(lidarTransform.GetRotation(), lidarTransform.GetTranslation()).GetInverse();
const float maxRange = m_addMaxRangePoints ? m_range : AZStd::numeric_limits<float>::infinity();

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

0 comments on commit 5de0d70

Please sign in to comment.