Exemplo n.º 1
0
        /// <summary>
        /// just for testing first (ray test)
        /// </summary>
        /// <param name="cr"></param>
        public void MaxMinResult(CollisionResult3D cr)
        {
            if (!cr.collision)
            {
                collision = false;
            }

            if (!cr.distance.HasValue)
            {
                distance = null;
                axisCol  = Vector3.Zero;
            }
            else if (!distance.HasValue || (cr.distance.HasValue && cr.distance > distance))
            {
                distance = cr.distance;
                axisCol  = cr.axisCol;
            }

            if (!cr.distanceReversed.HasValue)
            {
                distanceReversed = null;
                axisColReversed  = Vector3.Zero;
            }
            else if (!distanceReversed.HasValue || (cr.distanceReversed.HasValue && cr.distanceReversed < distanceReversed))
            {
                distanceReversed = cr.distanceReversed;
                axisColReversed  = cr.axisColReversed;
            }
        }
Exemplo n.º 2
0
        public CollisionResult3D To3D(Vector3 xDir, Vector3 yDir)
        {
            CollisionResult3D cr = new CollisionResult3D();

            cr.collision        = collision;
            cr.distance         = distance;
            cr.distanceReversed = distanceReversed;
            cr.axisCol          = xDir * axisCol.X + yDir * axisCol.Y;
            cr.axisColReversed  = xDir * axisColReversed.X + yDir * axisColReversed.Y;
            return(cr);
        }
Exemplo n.º 3
0
        public void MaxResult(CollisionResult3D cr)
        {
            if (cr.collision)
            {
                collision = true;
            }

            if (!distance.HasValue || (cr.distance.HasValue && cr.distance > distance))
            {
                distance = cr.distance;
                axisCol  = cr.axisCol;
            }

            if (!distanceReversed.HasValue || (cr.distanceReversed.HasValue && cr.distanceReversed > distanceReversed))
            {
                distanceReversed = cr.distanceReversed;
                axisColReversed  = cr.axisColReversed;
            }
        }