Jump to content
  • Advertisement
Sign in to follow this  

[SOLVED] [DX9] Bounding Volumes per subset - Transformations problem

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

Hi all,

Currently I'm working on phyics part of my renderer. I'm using nVidia PhysX.

I want to render bounding boxes of models as a physics debugging. Now I can create seperate bounding boxes for all subsets of the mesh. But when I transform'em and render, they're all positioning at the center of the model (i.e. center of the model's bounding sphere).

For example, I've a car and it has wheels and body as different subsets. I create bounding boxes for'em (with correct vMax and vMin values), then render. But I see wheels' bounding volumes are positioned at the center of model.

How can I solve this problem?

Thanks in advance.

[Edited by - programci_84 on October 16, 2010 8:02:07 PM]

Share this post

Link to post
Share on other sites
Forget it guys, I've solved it :D

Here's the trick:
* Take model's world matrix:

matrix mWorld = model.worldMatrix;

* multiply the center point of bounding box with that matrix:

vec3 center = (BBox.vMax + BBox.vMin) * .5f;
vec3 centerW = TransformCoord (center, mWorld);

* manually position that matrix at that centerW thing:

mWorld.m41 = centerW.x; mWorld.m42 = centerW.y; mWorld.m43 = centerW.z;

* Then use that matrix while rendering.

Thanks anyway.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!