3
\$\begingroup\$

I have a bounding sphere and a bounding box that should be intersecting, however, Intersects(...) is returning false. For example, the following returns false:

new BoundingSphere(new Vector3(500, 105, 0), 25).Intersects(
    new BoundingBox(new Vector3(466,219,0), new Vector3(519,26,0))
)
\$\endgroup\$
7
\$\begingroup\$

According to http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.boundingbox.boundingbox.aspx

The constructor of BoundingBox expects minimum and maximum points. Your second vector's y is less than your first vector's y. This might break the intersection test.

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ No might about it. It will break it and that is the problem. Good answer. \$\endgroup\$ – Steve H Jun 19 '13 at 23:14
  • \$\begingroup\$ True enough. That was it. A silly issue, and the one I haven't noticed because I still think of y as going towards the bottom. Thanks. \$\endgroup\$ – Stonehead Jun 19 '13 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.