• Advertisement
Sign in to follow this  

ComputeBounding Sphere/Box

This topic is 4216 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I have a bunch of boxes, and I want to place them next to each other. In 2D this is simple. You just calculate the length of the square and then place each square the same length away. I wanted to do the same thing with a mesh/vertex buffer in 3D, but I'm not sure how. I know how to use the BoundingBox and BoundingSphere for collision detection, but I don't know how to place them next to each. Any help would be greatly appreciated, thanks :)

Share this post


Link to post
Share on other sites
Advertisement
you would position the box's/spheres when applying the world space transforms in the same way you do your actual object


sorry to hijack the thread but i have a related question and didnt think it was necessary to make another thread, how would i use the Vector param in compute bound sphere / box based on an index in the vertex buffer (data obtained from getnumboneinfluences()) i have the stride and all other data just i only wanted to apply it to a specific set of data

Share this post


Link to post
Share on other sites
I'm sorry kind sir, but that didn't make any sense to me. Perhaps some source code or an example??

Share this post


Link to post
Share on other sites
sorry i have a vertex array and a list of vertices to select from that based on what part of the object the corrispond to so how could i use one of the calc bounding volume functions based on this data

Share this post


Link to post
Share on other sites
@Stowelly - I don't really understand either of your posts. It may well be a better idea to start your own thread and rephrase your question as clearly and with as much detail as possible.

Regarding the original question...

Are you asking how to use the API to move an object assuming you know where you want to move it to; or are you asking how to find out where to move an object to if given bounding coordinates?

You can move geometry around using matrix transformations (typically constructed using scaling/rotation/translation). Exactly how you do this requires more detail about your D3D application - specifically, are you using the fixed function pipeline (SetTransform() calls) or the programmable pipeline (vertex shaders)?

Given the increased freedom in 3D you stating "place them next to each other" isn't too clear - you need to define (as much for yourself as for us) quite what "next to" is. Do you mean next to each other in world coordinates or next to each other when they finally get displayed on screen? They are subtley different.

Using the details from a bounding box of sphere can be used to generate a translation matrix that should stop two objects from overlapping/intersecting. For example, if Obj1 has a radius of 10.0 and Obj2 has a radius of 5.0 then translating them such that they are 15 units apart should do the trick. But, wrt to my previous paragraph, there are a lot of possible positions 15 units away and you need to decide which one you want.

Maybe fill us in on some more mathematical/precise details and we can help out.

hth
Jack

Share this post


Link to post
Share on other sites
Sorry about that. I'm asking how to find out where to move based on the ComputeBounding Sphere/Box functions (or some other method). I'll try my hardest to describe it. I have an array of cubes. I want to make a plane (length, width, height, surface area, etc) with the cubes. Right now, when I create one cube, I find the radius and then I "trial and error"-like to try and find a number to multiply the radius by so that the cubes (when displayed on the screen) are next to each other (so the plane created doesn't have gaps). Much like bricks of a building are placed next to each other, I'd like to the same with the cubes. There has to be a better way to do that instead of guessing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement