Original Post
hi, i am facing a little problem concerning vertex data. i would like to use engine created object oriented bounding boxes for macro collision checks. i implemented this using the jacobi method, retrieving the eigenvectors and the centroid to build the bounding box. it works fine with static meshes. the problem arises when i try to port this algorythm to skinned models. a quick point draw of the vertices retrieved by this method:
protected override Vector3[] GetVertices()
// To do this, the mesh must exist
if (mesh != null)
{
// This will get the verts info from the vertex buffer
GraphicsStream stm = mesh.VertexBuffer.Lock(0, 0, LockFlags.None);
// The vertices to be returned
Vector3[] v = new Vector3[mesh.NumberVertices];
// Loop through the vertices
for (int i = 0; i < mesh.NumberVertices; i++)
{
// Get the current vertex info
v = (Vector3)stm.Read(typeof(Vector3));
}
// Unlock the vertex buffer
mesh.VertexBuffer.Unlock();
// Return the vertices
return v;
}
return null;
}
shows that the vertices do not move, and are (probably) stuck in the model's original position (ie, not affected by skeleton influences). so what i would like to ask is, how do i access properly the vertex data to get the skeleton weighted vertices positions?