Changed position constraints to be less bouncy.

This commit is contained in:
Steffen Fündgens 2015-02-13 12:15:54 +01:00
parent 91048e09f8
commit 012d117c7e

View File

@ -37,7 +37,7 @@ void Physics::takeUpdateStep(float timeDiff)
if(allPositionConstraints[i].position != allPositionConstraints[i].body->getCenterOfMassPosition()) //if constraint != position of the body because otherwise dir = 0 if(allPositionConstraints[i].position != allPositionConstraints[i].body->getCenterOfMassPosition()) //if constraint != position of the body because otherwise dir = 0
{ {
btVector3 dir = allPositionConstraints[i].position - allPositionConstraints[i].body->getCenterOfMassPosition(); btVector3 dir = allPositionConstraints[i].position - allPositionConstraints[i].body->getCenterOfMassPosition();
dir = dir*allPositionConstraints[i].strength; dir = dir*allPositionConstraints[i].strength - allPositionConstraints[i].body->getLinearVelocity();
allPositionConstraints[i].body->applyCentralForce(dir*allPositionConstraints[i].strength); //apply a foce upon the object pushing it towards the constraint position allPositionConstraints[i].body->applyCentralForce(dir*allPositionConstraints[i].strength); //apply a foce upon the object pushing it towards the constraint position
} }
} }