Joining Objects During GamePlay?

Does anybody know if there’s a way to join objects in the game engine?

If you mean “join” in the sense of joining objects with Ctrl+J in Blender, the answer is either “no. it is not possible.” or “it is much to difficult to be worth the effort.” What do you need to do that you cannot accomplish with parenting?

BTW, to save everyone the trouble of asking, here is the “too difficult to be worth the effort” way:

  • Build Blender using the “build as python module” option. (I have not gotten this to work successfully… the bpy module I get when building Blender 2.62 and Blender 2.63 as modules cannot be successfully imported in Python 3.2. The tutorial for doing this is based on Blender 2.61, so that might work. I don’t think the BGE will care which version of Blender your bpy module was built from.)
  • Use the bpy module to join the two meshes into a new mesh.
  • Use the LibLoad() function to load the new mesh into the scene from raw binary RNA data.

Theoretically, that is…

I just had an idea that involved several objects (100s maybe), that would be added to the scene, that would be static, so I figured after they were added I’d join them into 1 object to save memory. I just figured it be away to improve the performance a little bit. (1 object vs 1000’s), but if I decide to do anything with my Idea I’ll just use other methods I guess. Thanks for the quick reply!:slight_smile:

You could also add a kind of ‘fodder’ mesh that contains more than, or just enough faces as the different objects you have, and then move the vertices of the fodder mesh with Python to match the objects’ mesh vertices. After that, the individual objects could be deleted, and the physics mesh of the fodder mesh updated (though this might be a bit slow and may or may not be accurate; I haven’t tried it as of yet). The materials / textures would have to match, but it would work.

ya, that could work, I’ll probably just have the smaller objects be replaced by pre made objects, every so often.:slight_smile: I dont think this will be to slow