[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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user