# [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.

## 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?

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

##### 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.
-R

• 48
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631374
• Total Posts
2999653
×