Friday, January 26, 2007

OOB INTERSECTION TEST USING XNA

As we wait for the second part of Sharky's tutorial "XNA Collision Detection for 3D models", there is an interesting source code to study, which was programmed and uploaded by Minh at Channel 9 site.

Too many links for one sentence, don't you think?

Anyway, just dowload the code, build the assembly and play around with the test demo to see how the test performs.

See ya!

5 comments:

  1. Yeah, I stumbled on that one the other day. Looking very good!

    I'd certainly have preferred to use Boxes rather than Sphere's anyway.

    The only reason I didn't was because the XNA BoundingBox is an Axis aligned implementation.

    Good to see Minh is on the case, because I wouldn't have had a clue how to achieve that!

    It'd be nice if XNA provided something like it out of the box.

    ReplyDelete
  2. Hi man,

    There's a link in that page to a great whitepaper on the matter -which I forgot to comment ("Collision Queries Using Oriented Bounding Boxes"). I'm starting chapter 3 right now, and let me tell you that the whole paper so far is quite easy to understand (of course, not for beginners).

    BTW, I've seen your example code, complied and executed it but an "InvalidOperationExceptions" is thrown with the following text "The method call is invalid." at line 153 (device.DrawIndexedPrimitives).

    I've been trying to figure out what's happening but dunno ... :(

    ReplyDelete
  3. Oh that's weird. Sounds like the code that draws the spheres. I based most of that code from some other tutorial/sample.

    You could try commenting out the lines that call the BoundingSphereRenderer.Draw() method. Won't see the sphere's, but at least to see that the rest of the sample works. Unfortunately my cursor for testing collisions is rendered as a sphere, so not much use to you if you can't see it!

    ReplyDelete
  4. Yes, I know. I've already done that and works ok. The code seems ok, so it's pretty weird ...

    EDIT: I did it. I deleted the "*2" and the circles were perfectly rendered. Did it work for you with the "*2"?

    ReplyDelete
  5. Yeah the * 2 works fine for me. I don't even know what it's for but it was in the original sample/tutorial code I borrowed for the circle drawing stuff.

    I'll experiment, but thanks alot for letting me know about it.

    ReplyDelete

Any thoughts? Post them here ...