SoftBody Manipulation (movement and torque)

XMight
Posts: 32
Joined: Tue Feb 22, 2011 1:00 pm

SoftBody Manipulation (movement and torque)

Post by XMight »

For the case of the rigid bodies I use:

Hooke's lax and damping effect to move objects with my 3D cursor, and this line to apply the force:

Code: Select all

body->applyCentralForce(btVector3(forceOnBody[0], forceOnBody[1], forceOnBody[2]));
Hooke's law + torsion effect to apply rotation with my 3D cursor, and this line to apply the force:

Code: Select all

body->applyTorque(btVector3(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ()));
In the case of soft bodies, I can't do the same thing. Instead, to move the whole soft body, I use:

Code: Select all

softBody->addForce(btVector3(forceOnBody[0], forceOnBody[1], forceOnBody[2]));
softBody->applyForces();
For the velocity in the damping formula, I simply use the velocity of the first node of the first face (not too smart and correct, but it works at least), since I can't get the velocity of the whole body, even if I can set it (dunno why this one is present, and another not).

Anyway, I haven't found a workaround for the torque on the soft bodies.
I imagine that not many need this thing, and not many have the experience with this, maybe no one, but anyway, can someone suggest how can I apply the torque on the whole softBody?

P.S. I tried softBody->rotate(btQuaternion(1.0, 0.0, 0.0, 1.0)) and with other values, and no success (Unhandled exception is caused by the method on my softBody).