Moving vertices runtime for meshes

Is it possible to move vertices runtime in BGE for both visual and physics meshes? I’d like to try around creating some softbody stuff, but I need to know if I can actually move vertices.
Thanks!

You can move verts in game but you can’t create or delete any.
It’s good for making deformations like damage to a wall or something but it’s best used either during an initiation script (like when designing random terrain) or with no physics objects, since updating the physics mesh can be costly. Otherwise it’s better to just use switch mesh with a pre-edited deformed mesh.

Using the built in softbodies would be best, or using a rigged mesh with some kind of physics simulation on the bones if you want a non-physics softbody (like breast/flesh simulation or a cape or something).

@adriansnetlis
In short, yes you can move vertices with python/cpu or glsl/gpu(faster) and triangle physics mesh can be updated in real time as well, furthermore you can consult BluePrintRandom in regards to updating primitive compound shapes in real time

There are some verlet cloth physics done outside of bullet or bge, you can google those examples if you wanted to know more

Now with all that said… I agree with Smoking_mirror you’re better off using bullet soft-body than implementing your own vertex manipulation, python/cpu is slow to begin with and you can’t sync physics(cpu cycles) even with glsl(gpu cycles) in real time, it’s months and years worth of investment if you’re determined enough to do it, good luck

The soft-bodies built in Blender are limited and a bit broken. They even dont support lots of dynamics(e.g. applyTorque). Also, they only seem to act like indeed soft bodies without allowing very stiff objects. I wish they had stiffness and damping settings, in best way - controllabe per-vertex. They also seem to not to work as needed when setting to non-elastic. They tend to fall down without holding together. That’s why you can’t simulate rigid object which is able to deform, which has low elasticity. It is kind of incomplete.

In that case how about a rigged ragdoll?
Build the shape you need, set up the collision boxes and then fit the armature to the collisions.

You can have semi stiff objects like dolls or teddybears or zombies or baguettes or whatever which behave like softbodes (falling down, rolling, bending etc…) but are much more controllable and less resource hungry.

I more like mean a solid object(imagine a tinker plane for this moment) which can take damage, flex etc. It must react to other objects, deform, also have a bit of elasticity(different things can be either more plastic or elastic). And it should, of course, work with forces, torques, impulses etc.

use rigid body joints, and spring forces

then use copy rot + armature bones to get the right graphics mesh

Notice I made a add object and pin in place in runtime script? (with rigid body joint)

1 -add all the ragbones in the blender GUI (not constraints)

2 -Bind armature bones to copy rotation of the ragbones

2 -On P -> in game engine make constraints and set spring forces limits etc using python

https://www.blender.org/api/blender_python_api_2_76_1/bge.constraints.html?highlight=6dof%20constraint#bge.constraints.GENERIC_6DOF_CONSTRAINT

I have a example of building a RBJ in runtime here

Edit: and here is a very nice one http://bgepython.tutorialsforblender3d.com/PhysicsConstraints/6DOF/LinearSpring/createConstraint

Attachments

AddObjectAnd6doFInRuntime.blend (479 KB)