[LYN-3099] Fixed some issues with vegetation planting on surfaces (#1554)

* [LYN-3099] Fix vegetation raycasts to use bounded ray queries instead of FLT_MAX.
Raycasts with a distance of FLT_MAX sometimes overflowed deep in IntersectSegmentTriangleCCW, so it's better to have strict start/end positional queries.  We have specific starts and ends anyways, so it's a safer approach anyways.
This also adds support for Non-Uniform Scale for meshes, since it was clearly not working correctly in vegetation when testing various scaled meshes.

* Addressed PR feedback
This commit is contained in:
Mike Balfour
2021-06-24 12:54:48 -05:00
committed by GitHub
parent 2a1a523091
commit c873ddac45
6 changed files with 65 additions and 21 deletions
@@ -83,9 +83,9 @@ namespace SurfaceData
bool GetMeshRayIntersection(
const AZ::RPI::ModelAsset& meshAsset, const AZ::Transform& meshTransform,
const AZ::Transform& meshTransformInverse, const AZ::Vector3& rayOrigin,
const AZ::Vector3& rayDirection, AZ::Vector3& outPosition,
AZ::Vector3& outNormal);
const AZ::Transform& meshTransformInverse, const AZ::Vector3& nonUniformScale,
const AZ::Vector3& rayStart, const AZ::Vector3& rayEnd,
AZ::Vector3& outPosition, AZ::Vector3& outNormal);
AZ_INLINE void AddMaxValueForMasks(SurfaceTagWeightMap& masks, const AZ::Crc32 tag, const float value)
{