| | 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 | | Collider[] colliders = Physics.OverlapBox(center, box * 0.5f, rotation, |
| | 13 | | LayerMask.GetMask(AVATAR_TRIGGER_LAYER), QueryTriggerInteraction.Collide); |
| | 14 | |
|
| 5 | 15 | | if (colliders.Length == 0) |
| 5 | 16 | | return null; |
| | 17 | |
|
| 0 | 18 | | bool hasExcludeList = excludeColliders != null; |
| 0 | 19 | | HashSet<GameObject> result = new HashSet<GameObject>(); |
| 0 | 20 | | foreach (Collider collider in colliders) |
| | 21 | | { |
| 0 | 22 | | if (hasExcludeList && excludeColliders.Contains(collider)) |
| | 23 | | continue; |
| | 24 | |
|
| 0 | 25 | | result.Add(collider.transform.parent.gameObject); |
| | 26 | | } |
| 0 | 27 | | return result; |
| | 28 | | } |
| | 29 | | } |
| | 30 | | } |