Is it possible to generate mesh at runtime in blender game engine? That is, is it possible for blender to generate meshes using python code when the game runs?

I really would like to know if this is possible, as my final year project requires use of this.

  • $\begingroup$ accordinto the DOCs : You can only change the vertex properties of a mesh object, not the mesh topology you can't $\endgroup$ – Chebhou Jul 24 '15 at 15:09
  • $\begingroup$ Now, I know that BGE does not allow runtime generation of meshes. So if not at runtime, is it possible to generate these meshes through python script, just before a game starts? I am looking for something like a preloader that generates all mesh before a game level begins. Is it possible? $\endgroup$ – Gabriel Jul 25 '15 at 11:52
  • $\begingroup$ Yes you can : ) there are many examples see this DOC page also you can find others by goggling if you hit another problem just ask. $\endgroup$ – Chebhou Jul 25 '15 at 12:06
  • $\begingroup$ Thanks for the reply. But the page you mentioned speaks only of using python script to generate meshes in blender. It doesn't solve my question of whether it is possible to develop a preloader that would generate a mesh before a game runs. $\endgroup$ – Gabriel Jul 25 '15 at 12:29
  • $\begingroup$ I don't know about that , you can edit the question to get attention ( there are more experienced bge users here ) $\endgroup$ – Chebhou Jul 25 '15 at 12:31

The comment by Chebhou is almost correct... One thing that may not be clear, is that you can import bpy into bge scripts (many sources say this is not something you should do, but I have experienced no harm in using it during development, however, you can only use it in Blender - it will not work when you build/compile your final game). Thusly you can use the examples on the wiki page they linked to get started in generating meshes procedurally for your game, within Blender during development.

Unfortunately, there appears to be no way currently (as of version 2.78a) to construct a mesh from scratch during runtime of your game.

A couple of potentially useful rabbit holes, to show there may still be hope (will update this answer as/when I discover more):

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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