예제 #1
0
        public bool IntersectWith(Vector3 thisOffset, AxisAlignedBB other, Vector3 otherOffset)
        {
            var thisOffsetted  = new AxisAlignedBB(Min + thisOffset, Max + thisOffset);
            var otherOffsetted = new AxisAlignedBB(other.Min + otherOffset, other.Max + otherOffset);

            return(thisOffsetted.IntersectWith(otherOffsetted));
        }
예제 #2
0
        public GroundStairs(Direction direction)
        {
            Mesh      = MeshToUse;
            Direction = direction;
            Length    = 1.2f;
            var rotation = DirectionHelper.GetRotationFromDirection(direction);
            var p1       = new Vector4(-3f, 0f, -Length, 1) * rotation;
            var p2       = new Vector4(3f, 0.3f, 0f, 1) * rotation;
            var p1v3     = new Vector3(p1);
            var p2v3     = new Vector3(p2);

            BoundingBox = new AxisAlignedBB(Vector3.ComponentMin(p1v3, p2v3), Vector3.ComponentMax(p1v3, p2v3));
        }
예제 #3
0
 public bool IntersectWith(AxisAlignedBB other)
 {
     if (other == null)
     {
         return(false);
     }
     if (other.Max.X <= Min.X || other.Min.X >= Max.X)
     {
         return(false);
     }
     if (other.Max.Y <= Min.Y || other.Min.Y >= Max.Y)
     {
         return(false);
     }
     return(other.Max.Z > Min.Z && other.Min.Z < Max.Z);
 }
예제 #4
0
        public GroundSimple(Direction direction)
        {
            Mesh      = MeshToUse;
            Direction = direction;
            Length    = 6f;
            var rotation = DirectionHelper.GetRotationFromDirection(direction);
            var p1       = new Vector4(-3f, -0.5f, -Length, 1) * rotation;
            var p2       = new Vector4(3f, 0f, 0f, 1) * rotation;

            PossibleObstaclePositions = new Vector3[2];
            for (int i = 0; i < 2; i++)
            {
                PossibleObstaclePositions[i] = (new Vector4(0, 0, -i * 3, 1) * rotation).Xyz;
            }
            BoundingBox = new AxisAlignedBB(Vector3.ComponentMin(p1.Xyz, p2.Xyz), Vector3.ComponentMax(p1.Xyz, p2.Xyz));
        }
예제 #5
0
파일: Obstacle.cs 프로젝트: Entrivax/42run
 public Obstacle(AxisAlignedBB boundingBox, Vector3 position, Direction direction)
 {
     BoundingBox = boundingBox;
     Position    = position;
     Direction   = direction;
 }
예제 #6
0
 public ObstacleTrash(AxisAlignedBB boundingBox, Vector3 position, Direction direction) : base(boundingBox, position, direction)
 {
     Mesh = MeshToUse;
 }