Best method for moving soft body vertices at runtime without glitches...

Hi all,

Is it possible to move the vertices of a soft body physics object at runtime in the game engine?

I’ve been trying for days with some success: For example the following code magnifies a currently running soft body mesh by 20% but for odd reasons the object gets a new random direction and jumps off its old position by a couple meters… (and the new mesh contains the deformation of the soft body as it was when the following code get calls)

oCont = bge.logic.getCurrentController()
oObj = oCont.owner
oMesh = oObj.meshes[0]
nVerts = oMesh.getVertexArrayLength(0)
for nVert in range(0, nVerts):
    v = oMesh.getVertex(0,nVert)
    v.x *= 1.2
    v.y *= 1.2
    v.z *= 1.2
bRes = oObj.reinstancePhysicsMesh()
print("
  • Reinstance=", bRes)

I’m fairly close and possibly I can fix this by caching the verts when the soft body is at rest during initialization, but I was wondering if other techniques exist and if there is anything I can improve to fix the problems such as orientation and mesh position problems I’m having…

Any thoughts?

Dan,