1
This commit is contained in:
@@ -35,22 +35,14 @@ namespace BITKit.Sensors
|
||||
}
|
||||
private readonly DoubleBuffer<IEnumerable<Transform>> _detectedDoubleBuffer=new();
|
||||
private IEnumerable<Transform> _detectedBuffer;
|
||||
private void Update()
|
||||
{
|
||||
if (autoUpdate && SensorGlobalSettings.Enabled)
|
||||
{
|
||||
Execute().Forget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override UniTask Execute()
|
||||
{
|
||||
if (frameUpdater.Allow is false) return UniTask.CompletedTask;
|
||||
var location = new Location(transform);
|
||||
var length = Physics.OverlapSphereNonAlloc(location, radius, colliders, detectLayer);
|
||||
var length = Physics.OverlapSphereNonAlloc(Transform.position, radius, colliders, detectLayer);
|
||||
Profiler.BeginSample("Filter Detected Colliders");
|
||||
var _newDetected = from x in colliders.Take(length) where IsValid(x) select x.transform;
|
||||
Profiler.EndSample();
|
||||
//detected = _newDetected.ToArray();
|
||||
_detectedDoubleBuffer.Release(_newDetected);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
@@ -82,7 +74,7 @@ namespace BITKit.Sensors
|
||||
if (!requireSight) return false;
|
||||
var transform1 = _collider.transform;
|
||||
var position = transform1.position;
|
||||
var location = new Location(transform);
|
||||
var location = new Location(Transform);
|
||||
var length = Physics.RaycastNonAlloc(
|
||||
location.position,
|
||||
position - location,
|
||||
|
Reference in New Issue
Block a user