# Rigging a surface for game engine

Let's say I have a surface, which is divided as follows:

  A   B   C   D
0 +---+---+---+
|   |   |   |
1 +---+---+---+
|   |   |   |
2 +---+---+---+
|   |   |   |
3 +---+---+---+


This surface also have a subdivision-surface modifier added to it, with level 3. What I want to achieve is, when I grab each of the above points, the other points should "react" along with it as well.

So for example: if I grab A:0 my grab will also effect its closest neighbors: B:0, B:1 and A:1 as well. Now, here comes the hard part, which I couldn't solve because of the dependency cycles it might generate when I try it with bones: if I grab B:0 it should effect C:0, C:1, B:1, A:1 and A:0 as well. Which basically means, "for one second" B:0 becomes the parent of A:0, which of course is not possible, as I already assigned B:0 as a child of A:0.

So what I'm looking for is either a trick to have this grid like bone rig, or some other solutions (such as a 2D lattice or anything) which is available through BGE.

• I could come up with a solution to do this with bmesh, if that module is accessible from BGE? it would be able to return the indices or identifiers of those nodes, If not you could manually fill a dict which maps node-vertex to neigbours.. May 12, 2015 at 15:54

So you want something like proportional edit, where you can grab any vertex and the neigbouring ones move along with it as well?

To do this, simply making sure the weightings (between the bones and the mesh) extend so that some vertices are controlled by multiple bones.

So this is the weight normally:

And this is it expanded:

If you expand all of them, then, although the neighbouring bones won't actually move, there will be the right effect (As far as I understand what you want): In this case, I could probably have expanded the area of effect some more. And, you may notice you have to move the bone further to get the deflection you want. This is because the vertices you are moving are also influenced by the surrounding 8 bones, so will not move quite so much.

you can do this with Glsl script,

or python and maybe gsl nodes,

and with bones.

if you need physics to work, I think the only possibility is python,

(scaling and moving physics objects and deforming the graphics mesh however you feel like)