Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am use to XNA and starting to learn XNA for Silverlight 5. My Question is that in XNA when you create a Model and load it using content.load you are able to access the models Position, scale etc.. In Silverlight XNA these options are not available. It would be possible to change the Models position using World Translate, but I need the models position for collision detectection using boundingSphere Any Advice??

share|improve this question

XNA should allow you to do something like this to create your BoundingSphere, so long as you get grab the vertex buffer for your model.

List<Vector3> vertices = GetModelVertices(scale);    
BoundingSphere sphere = BoundingSphere.CreateFromPoints(vertices);

// Gets the vertices that make up a model
public List<Vector3> GetModelVertices(float Scale)
    List<Vector3> verts = new List<Vector3>();

    VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[numVertices];
    foreach (VertexPositionNormalTexture vertex in vertices)
        verts.Add(vertex.Position * Scale);

    return verts;

Alternatively, you should be able to iterate through each ModelMesh part in your model, and each of those have a BoundingSphere that you can query. From that you can call BoundingSphere.CreateMerged(BoundingSphere, BoundingSphere), for each of the bounding spheres on the ModelMesh objects, and combine them to get your final bounding sphere.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.