A bit new to NMesh module and stuff - I want to create a new labyrinth by extruding the faces of a grid
Experimenting, I’ve tried modifying (on an in game event) the coordinates of verts but can’t see the result in the game game even if print statememntn to the coords seems fine.
Can’t even find a tut for mesh manipulations (for within game) modification of the basic meshed objects of the scene.
All I know about in-game mesh manipulation is the collision geometry is unaffected, so you’d be able to walk right through the walls of the maze.
[edit] apparently this isn’t true; look further down the thread for more details.
Maybe you could use armatures that control individual extruded faces from the grid.
Or you could do what Dragon says.
( I don’t think you need a fancy Python algorithm, if you make the pattern yourself. )
OK, thanks for the input.
Probably that this solution should work then:
1- create a certain number of wall ‘parts’
2- rotate/reposition them on a new labyrinth pattern
I’ll be trying this later this evening (Montreal , Canada !)
If anyone as a idea that this will not work, let me know!
Ok so I’ve found a way to modify and even create new 3D objects in game.
My goal was to procedurally work the mesh of the scene to give a extra level of game variation.
Problem : BGE doesn’t play nicely with (Python) Blender module modification once the game is up.
SOLUTION: (basic)
On start-up, call Python script to:
1- modify the scene (modify existing objects and/or create new ones)
2- save the .blend file
3- restart this game (from Game actuator)
That’s it!!!
The rest is when, how much, changing files, etc all sorts of local problems to whatever your own game requires.
PS - I see this as a kludge, a work-around that might be useful, not the most elegant solution ;), but Hey! - it looks promising…
PPS If anyone wants my basic blend example, ask and I’ll post it!
It seems from the replies you’ve received that mesh manipulation in the Game Engine is not a well understood topic. I’ve never attempted it myself, but I know two things: it should be possible, and it most likely will be somewhat difficult.
An object can have more than one mesh, so you need to know which mesh you want. Assuming that there is only one mesh, it will be mesh 0. Use this code to get the mesh of the game object calling the script:
From there you can use the mesh manipulation functions in the MeshProxy class.
Actually, you can use reinstancePhysicMesh() (which is part of the MeshProxy class) to recalculate the bounds of a physics object after you have changed its mesh. I haven’t tried it out, but this might even work for meshes being deformed by an armature (which would be really cool ).
Edit: Looking at the original question again, I feel I should clarify something. It is not possible to create new vertices in the game engine (to the best of my knowledge). You can only move around pre-existing vertices. Also, the shape action actuator in 2.47 sounds like an easier solution.