PDA

View Full Version : bounding box , how?



burrows111
03-09-2010, 09:28 AM
Hi all,

can somebody please point me in the starting direction for coding a bounding box around a robot.

The robot is simply made up of cubes and moves as should do with user input, i have large cubes within this 3d world that represent buildings and i need to detect collision with any part of the robot with a building.
Any help on where to get started is great, i have had a look at previous posts but nothing very helpful

Thanks :0

Iulian B
03-09-2010, 01:36 PM
If the robot is simply made out of cubes, then you already have your "bounding boxes" and could use those for collision (if they aren't many).

Another idea would be to have an invisible "cube" built into the robot model, big enough to cover the entire robot, and use that for the collision.

The final idea would be an axis aligned bounding box (but that's a bad idea as a final solution); so you have your vertices, rotated and translated and just get the min and max of each of the vertices, per axis, and use those as the two corners of the axis aligned bounding box. So, you get each x component of all the vertices, store the minimum and maximum, do the same for the y and z. After that, the axis alligned bounding box has the corners in minX,minY,minZ and maxX,maxY,maxZ.

Or, you could use a bounding sphere... just saying'