Wednesday 4 January 2012

I want to see my bounding boxes

I want to try and figure out why my collision routines are all messed up now.

The logic isn't that complex, it's just a bounding box that intersects another box. How can rotation cause so many issues?

Well, first things first I want to see if I can draw my bounding boxes around my player UFO to see how things are looking.

Drawing a bounding box can't be that difficult, I know all my points of the cube, just need to add some lines. Rather than re-invent the wheel, I'll check google first to see if someone has already solved this issue.

App Hub again never fails to disappoint, this wonderful shape renderer class will do just nicely (link)

Easy enough to bolt on to my current code and get my bounding boxes rendering.

So now I have my bounding boxes drawn around the player UFO I can instantly see a random effect to the bounding box. With every rotation update, the bounding box is changing shape.


This is because the bounding box is calculated with every update to ensure it stays aligned to my player UFO.

I think there is probably a better way of doing things, but for now I'm just going to remove the rotation at the point of the bounding box calculation and re calculate when positioning the 3d object.

That works, probably not ideal but I'll revisit this later on to clean it up.

No comments:

Post a Comment