This topic is now archived and is closed to further replies.

Local space volumes?

This topic is 5013 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

just take the ones generated by directx and just multiply them by the translation & rotation matrices of the object you are doing it for and you''ll end up with a world space volume


Share this post

Link to post
Share on other sites
Original post by Andy Reno
Do you know how i can create bounding box volumes in local space instead of at the origin?

The DX method creates them on the world origin.

All sugestions welcome

You may have your terminology a little mixed up. Models are stored in what''s called "model space" Usually, models are built with their center at (0,0,0). The DX methods that compute bounding volumes operate directly on the vertices of the mesh. So the bounding volume will likely be about the origin.

If you want your bounding volume to be in world space (the place in your scene where you''ve actually transformed your model to) then you need to transform the coordinates of your bounding volume as well. To do this, use the D3DXVec3TransformCoord using as input the bounding volume created by DX and the same matrix you used to transform your mesh in your scene.

If you''re doing this for collision detection, there may be better ways to do it. If you''re trying to intersect a ray with the objects in your scene, what you should be doing is transforming your ray to be in the "model space" of your mesh instead of trying to transform the bounding volume of the mesh to be in world space with your ray.

I don''t know what kind of collision detection you''re doing but if you do a search for articles here on gamedev and on flipcode, you''ll find all the info you need to do it right.


Share this post

Link to post
Share on other sites