Retrieving BoundingBox

Hi, I am at the point of adding physics, and I need model's extents to create a physics body.. i.e. the BoundingBox. I found a BoundingBox calculator in your library but I am not sure how to use it..

Do I need to recompile the model at a runtime with Bounding Box Calculator processor?

Thanks!

jwatte's picture

There is no compilation of

There is no compilation of assets at runtime.

You need to pass the data from the model you load into the function to calculate the bounding box, when you first load the model. You only need to do this once.

Ok I am not sure how to pass

Ok I am not sure how to pass loaded data to a content processor other then the one defined in properties window. I am barely familiar with content pipeline. But I have fixed it by moving bounding box calculation functions into animation processor. So everything is now done once the model is loaded with animation processor, and it looks dandy.

But now follow-up question. Besides the bounding box I also need model's 'center of object' point in world space. Assuming all models have different origins set up in 3DMax, I cant realy use these as accurate points for object's center. How do I get this value?

The way I understand it, I need a minimum point on model's mesh in worldspace coordinates. Then I would add half of bounding box size to it to get object's center. But how do I get the minimum point? Thanks

Ok I think I got it with some

Ok I think I got the center of model turns out there are online samples for that. But now the bounding is box I get is the one of model's initial pose gahhh. How do I get bounding box of animated model? Please help, thanks!