diff --git a/libraries/shared/src/ContactPoint.cpp b/libraries/shared/src/ContactPoint.cpp index c69f2ea8f2..2d55da9265 100644 --- a/libraries/shared/src/ContactPoint.cpp +++ b/libraries/shared/src/ContactPoint.cpp @@ -133,8 +133,8 @@ void ContactPoint::buildConstraints() { glm::vec3 perpDelta = delta - paraDelta; // use the relative sizes of the components to decide how much perpenducular delta to use - // perpendicular < parallel ==> static friciton ==> perpFactor = 1.0 - // perpendicular > parallel ==> dynamic friciton ==> cap to length of paraDelta ==> perpFactor < 1.0 + // perpendicular < parallel ==> static friction ==> perpFactor = 1.0 + // perpendicular > parallel ==> dynamic friction ==> cap to length of paraDelta ==> perpFactor < 1.0 float paraLength = glm::length(paraDelta); float perpLength = glm::length(perpDelta); float perpFactor = (perpLength > paraLength && perpLength > EPSILON) ? (paraLength / perpLength) : 1.0f; @@ -146,6 +146,10 @@ void ContactPoint::buildConstraints() { _distances[i] = glm::distance(_contactPoint, targetPosition); point->_position += HACK_STRENGTH * delta; } + } else { + for (int i = 0; i < _numPoints; ++i) { + _distances[i] = glm::length(glm::length(_offsets[i])); + } } } @@ -179,9 +183,6 @@ void ContactPoint::updateContact(const CollisionInfo& collision, quint32 frame) _offsetA = pointA - collision._shapeA->getTranslation(); _offsetB = pointB - collision._shapeB->getTranslation(); - // _contactPoint will be the weighted average of the two - _contactPoint = _relativeMassA * pointA + _relativeMassB * pointB; - // compute offsets for shapeA assert(_offsets.size() == _numPoints); for (int i = 0; i < _numPointsA; ++i) {