Esempio n. 1
0
        public static bool CalculateDistance <T>(ref T target, ColliderDistanceInput input, out DistanceHit result) where T : struct, ICollidable
        {
            var collector = new ClosestHitCollector <DistanceHit>(input.MaxDistance);

            if (target.CalculateDistance(input, ref collector))
            {
                result = collector.ClosestHit;  // TODO: would be nice to avoid this copy
                return(true);
            }

            result = new DistanceHit();
            return(false);
        }
Esempio n. 2
0
 public bool CalculateDistance(ColliderDistanceInput input, out DistanceHit closestHit) => QueryWrappers.CalculateDistance(ref this, input, out closestHit);