Skip to content
Snippets Groups Projects
Commit f51cd3c1 authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

Merge branch '72-bug-in-getfriction-function' into 'master'

Resolve "Bug in getFriction function"

Closes #72

See merge request walberla/walberla!143
parents 018b6cd5 9df5ef90
No related merge requests found
......@@ -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() );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment