Local space volumes?

Started by
5 comments, last by Andy Reno 20 years ago
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
IT''s Geeky
Advertisement
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

-me
what do I use as the multiplier?
Whats the variables I need to use in the mesh called?
IT''s Geeky
Since its for collision detection.
IT''s Geeky
quote: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.

neneboricua
Thanks neneboricua, thats exactly the function I was hoping to discover.

IT''s Geeky

This topic is closed to new replies.

Advertisement