hi,
i added gravity to the spring node and want to ask some developers if my approach is right.
in the springnode.cpp i add a gravity float variable to the goalForce.y vector like in this code snippet.
...
float gravity = data.inputValue(aGravity, &status).asFloat();
// computation
MFloatVector velocity = (_currentPosition - _previousPosition) * (1.0 - damping);
//velocity.y += gravity;
MVector newPosition = _currentPosition + velocity;
MFloatVector goalForce = (goal - newPosition) * stiffness;
goalForce.y += gravity;
newPosition += goalForce;
...
would this be right?
it works (somehow), but when the gravity is too high, i loose a lot of dynamics and then it feels not so right anymore…