Io sto cercando di realizzare il modello 3d di collisione in Silverlight 5. Per fare questo sto creando una BoundingBox (proprio come in XNA4.0):Silverlight 5 e VertexBuffer.GetData()
ho visto la stessa domanda VertexBuffer.GetData() and Silverlight 5 in questo collegamento ma nessuna risposta trovata.
public BoundingBox GetBoundingBoxFromModel(Model model)
{
BoundingBox boundingBox = new BoundingBox();
foreach (ModelMeshPart part in model.Meshes[0].MeshParts)
{
VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[part.NumVertices];
Vector3[] vertexs = new Vector3[vertices.Length];
part.VertexBuffer.GetData<VertexPositionNormalTexture>(vertices);
for (int index = 0; index < vertexs.Length; index++)
{
vertexs[index] = vertices[index].Position;
}
boundingBox = BoundingBox.CreateMerged(boundingBox, BoundingBox.CreateFromPoints(vertexs));
}
return boundingBox;
}