Force on 1 vertex

(Taiguen) #1

Hi everybody,

I’d like to apply a force on only one vertex of a mesh.
The object of course is dynamic with rigid body (no gravity in my scene but this doesn’t matter).

Imagine you have the mesh, you attach a string to one vertex and start pulling the string. This is the effect I want to get.

The problem is setForce (via py or actuator) apply on the object center. I want to be able to choose where to apply it.

I have considered converting my force on a vertex into a force and a torque on the center of gravity of the mesh.
But the object center isn’t necesarly the center of gravity.

When there is a collision between rigid bodys or friction on one body, the GE has to apply forces not in the object center. Maybe there is something that could be re-used.

Any suggestion?
I hope to have been clear enougth…
Note: if the force was to be applied on a face instead of a vertex it would be good too.

Thanks for help.

(Sutabi-old) #2

create an empty, parent the mesh to the empty, and when you want to make force on one vertex and sure the empty is moved to the empty, turn dynamic on (through python) and apply force.

(erwin) #3

you can also use applyImpulse, this takes attachment (location) and impulse vector.

See the demo called jenga, requires 2.40alpha2: