[ATOM-4343] Temporary fix for vegetation raycasts until full solution is implemented. (#1572)

Currently, the first time a raycast is attempted for a model, the raycast will fail and the model's kdtree will asynchronously get built.  This breaks the vegetation system, which expects the queries to always work.  This adds in a brute-force fallback for use while the kdtree is building.  However, other use cases like the Editor mouse cursor selection raycast still should get the current "silent failure" behavior, because otherwise the Editor will lock up for several seconds the first time the mouse moves over an extremely complex model.
This commit is contained in:
Mike Balfour
2021-06-24 17:30:24 -05:00
committed by GitHub
parent 1c5a4a3230
commit 567156b85a
6 changed files with 19 additions and 9 deletions
@@ -146,7 +146,9 @@ namespace AZ
AZ::Debug::Timer timer;
timer.Stamp();
#endif
const bool hit = modelAssetPtr->LocalRayIntersectionAgainstModel(rayStart, rayDir, distanceNormalized, normal);
constexpr bool AllowBruteForce = false;
const bool hit = modelAssetPtr->LocalRayIntersectionAgainstModel(
rayStart, rayDir, AllowBruteForce, distanceNormalized, normal);
#if defined(AZ_RPI_PROFILE_RAYCASTING_AGAINST_MODELS)
if (hit)
{