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

Here is a litte sample that I drew in Blender to visualize what I am planing to create:

Cone with spheres sample

I already have the code to generate the cone and the spheres as mentioned in my former Post Combine 3D objects in XNA 4.

I thought that it would be nicer to generate a model and add these models to the sceen graph. My problem for now is that I wasn't able to generate a model out of my primitivas. I was planning to create one Mesh for the cone and one for each sphere that I want to attach to the cone and arrange all this in a Model, but there are no constructors for a Model or a Mesh.

So the question is: Is there a way to generate a model out of my primitives?

share|improve this question
If you have a way to combine 3D objects, you might look at this sample: . It doesn't create an XNA.Model, but it creates everything you need to render it like one. – Nic Foster Jan 18 '12 at 5:48

If you want to create Model or Mesh objects, you do so in the content pipeline (via their builder counterparts). They aren't types you can create during run time (unless you run on Windows and willing to include the pipeline builder library in your game project). They're also sealed so no extending them.

Model objects are basically just a collection of meshes, bones, and an optional effect. Meshes are just a wrapper around a vertex and index buffer.

So your options:

  • Make your own version of the model/mesh class that can be generated at run-time.
  • Look into the content pipeline to pre-build Model objects. It's relatively easy as long as you're okay with having the primitive mesh be unchangeable at run-time.
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.