Esempio n. 1
0
        public void RenderAABB(AxisAlignedBoundingBox aabb)
        {
            Color color = new Color(1, 1, 1, 0.3f);
            float x, y, w, h;
            x = aabb.min.X;
            y = aabb.min.Y;
            w = aabb.max.X - x;
            h = aabb.max.Y - y;

            linebatch.Add(new LineVertex(new Vector3(x + w * 0, y + h * 0, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 0, y + h * 1, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 0, y + h * 1, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 1, y + h * 1, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 1, y + h * 1, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 1, y + h * 0, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 1, y + h * 0, 0), color));
            linebatch.Add(new LineVertex(new Vector3(x + w * 0, y + h * 0, 0), color));
        }
Esempio n. 2
0
 public void SetWorldLimits(Vector2 min, Vector2 max)
 {
     aabb = new AxisAlignedBoundingBox(ref min, ref max);
     size = max - min;
     cell = size / 32;
 }
Esempio n. 3
0
 public bool Intersects(ref AxisAlignedBoundingBox aabb)
 {
     // Exit with no intersecton if separated along an axis
     if (this.max.X < aabb.min.X || this.min.X > aabb.max.X) return false;
     if (this.max.Y < aabb.min.Y || this.min.Y > aabb.max.Y) return false;
     // Overlapping on all axis means AABBs are intersecting
     return true;
 }