Local space volumes?
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
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
-me
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement