diff --git a/src/pe/contact/ContactFunctions.impl.h b/src/pe/contact/ContactFunctions.impl.h index f48b0328124c735e4c003f50e7cec475449c6edf..2585eae0933ab139031d42dc066152585f14d836 100644 --- a/src/pe/contact/ContactFunctions.impl.h +++ b/src/pe/contact/ContactFunctions.impl.h @@ -148,10 +148,10 @@ inline real_t getFriction(ConstContactID c) { // Calculating the relative velocity const Vec3 rvel( c->getBody1()->velFromWF( c->getPosition() ) - c->getBody2()->velFromWF( c->getPosition() ) ); // Relative velocity - const real_t nvel( c->getNormal() * rvel ); // Normal relative velocity - const real_t tvel( c->getNormal() * ( rvel - c->getNormal() * nvel ) ); // Tangential relative velocity + const Vec3 nvel( ( c->getNormal() * rvel ) * c->getNormal() ); // Normal relative velocity + const Vec3 tvel( rvel - nvel ); // Tangential relative velocity - if( std::fabs( tvel ) > frictionThreshold ) + if( std::fabs( tvel.length() ) > frictionThreshold ) return Material::getDynamicFriction( c->getBody1()->getMaterial(), c->getBody2()->getMaterial() ); else return Material::getStaticFriction( c->getBody1()->getMaterial(), c->getBody2()->getMaterial() );