Exemple #1
0
        private void AssertBox(Vector3 moveDirection, float directionDelta, ref BoxCollider box, BoxDefinition boxDefinition, Vector3 sphereWorldPosition, float sphereRadius)
        {
            box.transform.position = moveDirection;
            Assert.IsTrue(Intersection.BoxIntersectsOrEntirelyContainedInSphere(boxDefinition, sphereWorldPosition, sphereRadius));

            box.transform.position = moveDirection + (moveDirection * (-1 * directionDelta));
            Assert.IsTrue(Intersection.BoxIntersectsOrEntirelyContainedInSphere(boxDefinition, sphereWorldPosition, sphereRadius));

            box.transform.position = moveDirection + (moveDirection * directionDelta);
            Assert.IsFalse(Intersection.BoxIntersectsOrEntirelyContainedInSphere(boxDefinition, sphereWorldPosition, sphereRadius));
        }
Exemple #2
0
        public void CubeEntirelyContainedInSphere()
        {
            var sphereWorldPosition = Vector3.zero;
            var sphereRadius        = 9999f;

            BoxCollider box = this.CreateBoxCollider();

            this.InitBox(ref box, Vector3.one, Quaternion.identity);
            box.transform.position = Vector3.zero;

            Assert.IsTrue(Intersection.BoxIntersectsOrEntirelyContainedInSphere(new BoxDefinition(box), sphereWorldPosition, sphereRadius));
        }
Exemple #3
0
        public void Execute(int SphereIntersectionJobDataIndex)
        {
            var  SphereIntersectionJobData = this.SphereIntersectionJobDatas[SphereIntersectionJobDataIndex];
            bool isInsideRange             = Intersection.BoxIntersectsOrEntirelyContainedInSphere(SphereIntersectionJobData.ComparedCollider, SphereIntersectionJobData.RangeTransform.WorldPosition, SphereIntersectionJobData.SphereRadius);

            if (SphereIntersectionJobData.ObstacleCalculationDataIndex != -1 && isInsideRange)
            {
                isInsideRange = isInsideRange && !this.IsOccludedByObstacleJobData[SphereIntersectionJobData.ObstacleCalculationDataIndex].IsOccluded(this.AssociatedObstacleFrustumPointsPositions);
            }

            this.IntersectionResult[SphereIntersectionJobDataIndex] =
                new RangeIntersectionResult
            {
                RangeIntersectionCalculatorV2UniqueID = SphereIntersectionJobData.RangeIntersectionCalculatorV2UniqueID,
                IsInsideRange = isInsideRange
            };
        }
Exemple #4
0
 private bool IsInside(RoundedFrustumIntersectionJobData RoundedFrustumIntersectionJobData)
 {
     return(Intersection.BoxIntersectsOrEntirelyContainedInSphere(RoundedFrustumIntersectionJobData.ComparedCollider, RoundedFrustumIntersectionJobData.RangeTransform.WorldPosition, RoundedFrustumIntersectionJobData.FrustumRadius) &&
            (Intersection.FrustumBoxIntersection(RoundedFrustumIntersectionJobData.RoundedFrustumPositions, RoundedFrustumIntersectionJobData.ComparedCollider) || Intersection.BoxEntirelyContainedInFrustum(RoundedFrustumIntersectionJobData.RoundedFrustumPositions, RoundedFrustumIntersectionJobData.ComparedCollider))
            );
 }