protected override bool TestVisibility(VisualAspect aspect) { //if not in cylinder, can not see it float aspRad = aspect.Radius; if (aspRad > MathUtil.EPSILON) { if (!Cone.ContainsSphere(this.transform.position, this.transform.position + this.Direction * _range, _startRadius, _endRadius, aspect.transform.position, aspRad)) { return(false); } } else { if (!Cone.ContainsPoint(this.transform.position, this.transform.position + this.Direction * _range, _startRadius, _endRadius, aspect.transform.position)) { return(false); } } if (this.LineOfSightMask.value != 0) { var v = aspect.transform.position - this.transform.position; using (var lst = com.spacepuppy.Collections.TempCollection.GetList <RaycastHit>()) { int cnt = PhysicsUtil.RaycastAll(this.transform.position, v, lst, v.magnitude, this.LineOfSightMask); for (int i = 0; i < cnt; i++) { //we ignore ourself var r = lst[i].collider.FindRoot(); if (r != aspect.entityRoot && r != this.entityRoot) { return(false); } } } } return(true); }