feedback from PR

This commit is contained in:
greerdv
2021-04-21 10:55:05 +01:00
parent 2d1ba34f8c
commit 496891b4c0
3 changed files with 7 additions and 5 deletions
@@ -12,7 +12,7 @@
#pragma once
#include <AzCore/std/containers/vector.h>
#include <AzCore/Math/Matrix3x4.h>
#include <AzCore/Math/Transform.h>
#include <Atom/RHI/IndexBufferView.h>
#include <Atom/RHI/StreamBufferView.h>
#include <Atom/RHI.Reflect/Format.h>
@@ -167,16 +167,18 @@ namespace AZ
bool Model::RayIntersection(const AZ::Transform& modelTransform, const AZ::Vector3& nonUniformScale, const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distanceFactor, AZ::Vector3& normal) const
{
AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender);
const AZ::Vector3 clampedScale = nonUniformScale.GetMax(AZ::Vector3(AZ::MinTransformScale));
const AZ::Transform inverseTM = modelTransform.GetInverse();
const AZ::Vector3 raySrcLocal = inverseTM.TransformPoint(rayStart) / nonUniformScale;
const AZ::Vector3 raySrcLocal = inverseTM.TransformPoint(rayStart) / clampedScale;
// Instead of just rotating 'dir' we need it to be scaled too, so that 'distanceFactor' will be in the target units rather than object local units.
const AZ::Vector3 rayDest = rayStart + dir;
const AZ::Vector3 rayDestLocal = inverseTM.TransformPoint(rayDest) / nonUniformScale;
const AZ::Vector3 rayDestLocal = inverseTM.TransformPoint(rayDest) / clampedScale;
const AZ::Vector3 rayDirLocal = rayDestLocal - raySrcLocal;
bool result = LocalRayIntersection(raySrcLocal, rayDirLocal, distanceFactor, normal);
normal = (normal * nonUniformScale).GetNormalized();
normal = (normal * clampedScale).GetNormalized();
return result;
}
@@ -232,7 +232,7 @@ namespace AZ
return m_configuration;
}
void MeshComponentController::OnTransformChanged([[maybe_unused]] const AZ::Transform& local, [[maybe_unused]] const AZ::Transform& world)
void MeshComponentController::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
{
if (m_meshFeatureProcessor)
{