Jump to content
  • Advertisement
Sign in to follow this  
newtechnology

Inaccurate bounding box

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

1466313_795805073779182_1936955470_n.jpg


Don't know why it happens, is it because i scale the model?

void Direct3D::buildAABBFarm()
{
D3DXCreateBox(pDevice, Farm.box.GetWidth(), Farm.box.GetHeight(), Farm.box.GetDepth(), &AABBFarm, 0);
 
 
}
 
void Direct3D::buildFarm()
{
LoadXFile("Main\\Models\\Farm.x", &Farm.mesh, Farm.mtrls, Farm.textures);
 
VertexPNT* v = 0;
 
Farm.mesh->LockVertexBuffer(0, (void**)&v);
 
D3DXComputeBoundingBox(&v->pos, Farm.mesh->GetNumVertices(), Farm.mesh->GetNumBytesPerVertex(), &Farm.box.minPt, &Farm.box.maxPt);
 
Farm.mesh->UnlockVertexBuffer();
 
D3DXMATRIX World;
D3DXMATRIX Scale;
 
D3DXMatrixTranslation(&World, -82.85f + 29.0f, 40.50f + 50.0f, 39.44f);
D3DXMatrixScaling(&Scale, 0.01f, 0.01f, 0.01f);
 
FarmWorld = Scale * World;
 
 
}
Edited by newtechnology

Share this post


Link to post
Share on other sites
Advertisement

Any transformation applied to the model should be applied to the bounding box, assuming an object space bounding box.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!