This commit is contained in:
CortexCore
2024-04-06 16:33:32 +08:00
parent 637bbef7d2
commit 37e7fcea51
42 changed files with 597 additions and 149 deletions

View File

@@ -25,12 +25,17 @@ namespace BITKit.OpenWorld
var bounds1 = _collider.bounds;
size = bounds1.size;
offset = bounds1.center - transform.position;
return;
}
Bounds bounds = new();
foreach (var x in GetComponentsInChildren<Collider>())
{
bounds.Encapsulate(x.bounds);
if (x.bounds.size.sqrMagnitude > 64)
{
Debug.LogWarning($"{x.gameObject.name}:Size is too large, please check the size of the collider");
}
}
size = bounds.size;
offset = bounds.center - transform.position;

View File

@@ -26,7 +26,16 @@ namespace BITKit.OpenWorld
var enabledCollider = arg2 is 0;
foreach (var x in colliders)
{
x.enabled = enabledCollider;
try
{
x.enabled = enabledCollider;
}
catch (Exception e)
{
BIT4Log.Warning<ColliderChunkObject>(gameObject.name);
BIT4Log.LogException(e);
}
}
}
#if UNITY_EDITOR

View File

@@ -48,6 +48,7 @@ namespace BITKit.OpenWorld
}
protected virtual void OnTick(float deltaTime)
{
if (!enabled) return;
while (_unregisterQueue.TryDequeue(out var obj))
{
_quadtree.Remove(obj);