[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:
+5
-1
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/NonUniformScaleBus.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
@@ -52,7 +53,7 @@ namespace SurfaceData
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
SurfaceDataMeshComponent(const SurfaceDataMeshConfig& configuration);
|
||||
SurfaceDataMeshComponent() = default;
|
||||
SurfaceDataMeshComponent();
|
||||
~SurfaceDataMeshComponent() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -86,6 +87,8 @@ namespace SurfaceData
|
||||
AZ::Aabb GetSurfaceAabb() const;
|
||||
SurfaceTagVector GetSurfaceTags() const;
|
||||
|
||||
AZ::NonUniformScaleChangedEvent::Handler m_nonUniformScaleChangedHandler; ///< Responds to changes in non-uniform scale.
|
||||
|
||||
SurfaceDataMeshConfig m_configuration;
|
||||
|
||||
SurfaceDataRegistryHandle m_providerHandle = InvalidSurfaceDataRegistryHandle;
|
||||
@@ -96,6 +99,7 @@ namespace SurfaceData
|
||||
AZ::Data::Asset<AZ::Data::AssetData> m_meshAssetData;
|
||||
AZ::Transform m_meshWorldTM = AZ::Transform::CreateIdentity();
|
||||
AZ::Transform m_meshWorldTMInverse = AZ::Transform::CreateIdentity();
|
||||
AZ::Vector3 m_meshNonUniformScale = AZ::Vector3::CreateOne();
|
||||
AZ::Aabb m_meshBounds = AZ::Aabb::CreateNull();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user