Merge branch 'make-your-branch' of github.com:AndrewMeadows/hifi into fix-tractor-action-initial-crazy

This commit is contained in:
Seth Alves 2018-02-02 18:15:59 -08:00
commit a6978a6dec

View file

@ -126,17 +126,16 @@ bool ObjectActionTractor::prepareForTractorUpdate(btScalar deltaTimeStep) {
withWriteLock([&]{ withWriteLock([&]{
if (linearValid && linearTractorCount > 0) { if (linearValid && linearTractorCount > 0) {
position /= linearTractorCount; position /= linearTractorCount;
_lastPositionTarget = _positionalTarget;
if (_positionalTargetSet) { if (_positionalTargetSet) {
_lastPositionTarget = _positionalTarget; _lastPositionTarget = _positionalTarget;
} else { _positionalTarget = position;
_lastPositionTarget = position; if (deltaTimeStep > EPSILON) {
} // blend the new velocity with the old (low-pass filter)
_positionalTarget = position; glm::vec3 newVelocity = (1.0f / deltaTimeStep) * (_positionalTarget - _lastPositionTarget);
if (deltaTimeStep > EPSILON) { const float blend = 0.25f;
// blend the new velocity with the old (low-pass filter) _linearVelocityTarget = (1.0f - blend) * _linearVelocityTarget + blend * newVelocity;
glm::vec3 newVelocity = (1.0f / deltaTimeStep) * (position - _lastPositionTarget); }
const float blend = 0.25f;
_linearVelocityTarget = (1.0f - blend) * _linearVelocityTarget + blend * newVelocity;
} }
_positionalTargetSet = true; _positionalTargetSet = true;
_active = true; _active = true;