How to make your own bounding box ?

Started by
1 comment, last by johnnyBravo 19 years, 11 months ago
Hi im making a gta style game in dx, and i need the corners of the car for the collision detection. But i am using .x meshes so i don''t know what those points are. How could i manually generate a bounding box, all i need is four points around the car. also i need to work it out in conjunction to the current matrix set if thats possible. i dont really want to use the d3dx bounding box method as it uses some weird max min, whatever that would be, and all i want is four points. thanks,
Advertisement
easy, just read thru all vertices, compare and store the max (x,y,z) & min (x,y,z) vertex values, that''s all.

actually D3DX lib just do the above thing for u.
the min will give you the lower left point, the max will give you the up right point. thats for 2D. you can ignore the z coordinate if thats all you want.

Note that you should calculate the bounding box for your car before you do any rotations... then once afterwards when you do rotations, make sure you rotate your bounding box too..

if you try to get the bounding box of your car after rotation you will end up with something like this (poor ascii art coming up):

|---||/\ ||\ \|| \/||---| 


If you imagine the kinda skewed box inside is your car... the bounding box you will get is the outer box.

This topic is closed to new replies.

Advertisement