mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-14 17:09:31 +07:00
fix big number raycast hit cout
This commit is contained in:
@@ -52,11 +52,17 @@ namespace IsoTools.Physics {
|
|||||||
int layer_mask = UnityEngine.Physics.DefaultRaycastLayers,
|
int layer_mask = UnityEngine.Physics.DefaultRaycastLayers,
|
||||||
QueryTriggerInteraction query_trigger_interaction = QueryTriggerInteraction.UseGlobal)
|
QueryTriggerInteraction query_trigger_interaction = QueryTriggerInteraction.UseGlobal)
|
||||||
{
|
{
|
||||||
var hit_count = UnityEngine.Physics.RaycastNonAlloc(ray, _raycastNonAllocBuffer,
|
do {
|
||||||
max_distance,
|
var hit_count = UnityEngine.Physics.RaycastNonAlloc(ray, _raycastNonAllocBuffer,
|
||||||
layer_mask,
|
max_distance,
|
||||||
query_trigger_interaction);
|
layer_mask,
|
||||||
return RaycastBufferToIsoRaycastHits(hit_count, results);
|
query_trigger_interaction);
|
||||||
|
if ( hit_count >= results.Length || hit_count < _raycastNonAllocBuffer.Length ) {
|
||||||
|
return RaycastBufferToIsoRaycastHits(hit_count, results);
|
||||||
|
} else {
|
||||||
|
_raycastNonAllocBuffer = new RaycastHit[_raycastNonAllocBuffer.Length * 2];
|
||||||
|
}
|
||||||
|
} while ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -247,12 +253,18 @@ namespace IsoTools.Physics {
|
|||||||
int layer_mask = UnityEngine.Physics.AllLayers,
|
int layer_mask = UnityEngine.Physics.AllLayers,
|
||||||
QueryTriggerInteraction query_trigger_interaction = QueryTriggerInteraction.UseGlobal)
|
QueryTriggerInteraction query_trigger_interaction = QueryTriggerInteraction.UseGlobal)
|
||||||
{
|
{
|
||||||
var collider_count = UnityEngine.Physics.OverlapBoxNonAlloc(
|
do {
|
||||||
center, half_extents, _overlapNonAllocBuffer,
|
var collider_count = UnityEngine.Physics.OverlapBoxNonAlloc(
|
||||||
Quaternion.identity,
|
center, half_extents, _overlapNonAllocBuffer,
|
||||||
layer_mask,
|
Quaternion.identity,
|
||||||
query_trigger_interaction);
|
layer_mask,
|
||||||
return OverlapBufferToIsoColliders(collider_count, results);
|
query_trigger_interaction);
|
||||||
|
if ( collider_count >= results.Length || collider_count < _overlapNonAllocBuffer.Length ) {
|
||||||
|
return OverlapBufferToIsoColliders(collider_count, results);
|
||||||
|
} else {
|
||||||
|
_overlapNonAllocBuffer = new Collider[_overlapNonAllocBuffer.Length * 2];
|
||||||
|
}
|
||||||
|
} while ( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user