|
|||||||
| Forum Home | Register | Members List | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||
|
Member
Location: N. America |
I am trying to display the bounding box spheres for all the meshes in the model.
I have them displaying, but for some reason(which obviously I don't know), they seem to be just out of place. Well, I'll put in my code first and then ramble. Loading the <int, BoundingSphere> dictionary: Code:
Model.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in Model.Meshes)
{
BoundingSphereDictionary.Add(mesh.ParentBone.Index,mesh.BoundingSphere);
}
Code:
Dictionary<int, BoundingSphere> tempBSDictionary = new Dictionary<int, BoundingSphere>();
foreach (int index in BoundingSphereDictionary.Keys)
{
BoundingSphere bs = BoundingSphereDictionary[index];
Matrix transformation = transforms[index] * Matrix.CreateTranslation(Posn);
bs.Center = Vector3.Transform(Vector3.Zero,transformation);
tempBSDictionary.Add(index, bs);
}
BoundingSphereDictionary = tempBSDictionary;
And, the Draw Call: Code:
foreach (int index in BoundingSphereDictionary.Keys)
{
foreach (ModelMesh mesh in boundingSphereModel.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.View = view;
effect.Projection = projection;
effect.World =
Matrix.CreateScale(BoundingSphereDictionary[index].Radius) *
//Matrix.CreateTranslation(BoundingSphereDictionary[index].Center);
transforms[index] * Matrix.CreateTranslation(Position);
}
mesh.Draw();
}
}
and comment the manual translation done via Code:
transforms[index] * Matrix.CreateTranslation(Position); I am essentially doing the same thing in update as well, but still I dont understand why is there, this discrepancy in the output ? Can somebody please help me out with this. Also, if you want me to upload the code, I can do that. Thanks |
||||||||
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 10:24 PM.














Linear Mode

