I'm doing this in XNA but it shouldn't be too different in DirectX
I'm getting the vertices of a box mesh from the vertexbuffer, now from those vertices I'd need to recreate that box as an oriented bounding box.
This is my code, in transformedvertices my vertices are stored in world space, a total of 24, now I'd need to be able to turn that into an oriented bounding box.
Anyone have any ideas?
Thanks in advance.
ModelMeshPart part = modelmesh.MeshParts[j];
n = part.NumVertices;
VertexPosition vertices = new VertexPosition[part.NumVertices];
modelmesh.VertexBuffer.GetData<VertexPosition>(part.BaseVertex * part.VertexStride, vertices, 0, part.NumVertices, part.VertexStride);
int t = MySkinnedModel.SkeletonBones.Count;
string names = new string [t];
for (int p = 0; p < t; p++)
names[p] = MySkinnedModel.SkeletonBones[p].Name.ToString();
Vector3 transformedvertices = new Vector3[(part.NumVertices)];
Matrix transformmatrix = MyAnimationController.SkinnedBoneTransforms;
for (int i = 0; i < part.NumVertices; i++)
transformedvertices[i] = Vector3.Transform(vertices[i].Position, transformmatrix);