| | 1 | | using System.Collections.Generic; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.ECSComponents.Utils |
| | 5 | | { |
| | 6 | | public static class ECSAvatarUtils |
| | 7 | | { |
| | 8 | | internal const string AVATAR_TRIGGER_LAYER = "AvatarTriggerDetection"; |
| | 9 | |
|
| | 10 | | public static HashSet<GameObject> DetectAvatars(in UnityEngine.Vector3 box, in UnityEngine.Vector3 center, in Qu |
| | 11 | | { |
| 5 | 12 | | HashSet<GameObject> result = new HashSet<GameObject>(); |
| | 13 | |
|
| 5 | 14 | | Collider[] colliders = Physics.OverlapBox(center, box * 0.5f, rotation, |
| | 15 | | LayerMask.GetMask(AVATAR_TRIGGER_LAYER), QueryTriggerInteraction.Collide); |
| | 16 | |
|
| 5 | 17 | | if (colliders.Length == 0) |
| 5 | 18 | | return result; |
| | 19 | |
|
| 0 | 20 | | bool hasExcludeList = excludeColliders != null; |
| | 21 | |
|
| 0 | 22 | | foreach (Collider collider in colliders) |
| | 23 | | { |
| 0 | 24 | | if (hasExcludeList && excludeColliders.Contains(collider)) |
| | 25 | | continue; |
| | 26 | |
|
| 0 | 27 | | result.Add(collider.transform.parent.gameObject); |
| | 28 | | } |
| 0 | 29 | | return result; |
| | 30 | | } |
| | 31 | | } |
| | 32 | | } |