From 9df5ef9071fdec28b51a3f46e3439eae6a5a2557 Mon Sep 17 00:00:00 2001 From: Christoph Rettinger <christoph.rettinger@fau.de> Date: Thu, 15 Nov 2018 11:14:05 +0100 Subject: [PATCH] Fix in getFriction function --- src/pe/contact/ContactFunctions.impl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pe/contact/ContactFunctions.impl.h b/src/pe/contact/ContactFunctions.impl.h index f48b03281..2585eae09 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() ); -- GitLab