Пример #1
0
        protected override int DoCast(Ray ray, RaycastHit[] hitArray)
        {
            var scale = transform.lossyScale;

            if (maxResults == 1)
            {
#if UNITY_2019_1_OR_NEWER
                return(PhysicsScene.
#else
                return Physics.
#endif
                       BoxCast(ray.origin, PhysicsSensorUtils.GetScaledBoxRadius(halfExtents, scale), ray.direction,
                               out hitArray[0], transform.rotation, PhysicsSensorUtils.GetCastDistance(maxDistance, scale),
                               layerMask, queryTriggerInteraction) ? 1 : 0);
            }

#if UNITY_2019_1_OR_NEWER
            return(PhysicsScene.BoxCast
#else
            return Physics.BoxCastNonAlloc
#endif
                       (ray.origin, PhysicsSensorUtils.GetScaledBoxRadius(halfExtents, scale),
                       ray.direction, hitArray, transform.rotation, PhysicsSensorUtils.GetCastDistance(maxDistance, scale),
                       layerMask, queryTriggerInteraction));
        }
Пример #2
0
        protected override int DoOverlapCheck(Vector3 center, Collider[] colliders)
        {
#if UNITY_2019_1_OR_NEWER
            return(PhysicsScene.OverlapBox
#else
            return Physics.OverlapBoxNonAlloc
#endif
                       (center, PhysicsSensorUtils.GetScaledBoxRadius(halfExtents, transform.lossyScale),
                       colliders, transform.rotation, layerMask, queryTriggerInteraction));
        }
Пример #3
0
 protected override int DoOverlapCheck(Vector3 center, Collider[] colliders)
 {
     return(Physics.OverlapBoxNonAlloc(center,
                                       PhysicsSensorUtils.GetScaledBoxRadius(halfExtents, transform.lossyScale),
                                       colliders, transform.rotation, layerMask, queryTriggerInteraction));
 }