# Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Friction direction and impulse problemPosted: Fri Mar 09, 2012 5:00 am

Joined: Wed Feb 01, 2012 5:37 am
Posts: 5
Hi!

I had trouble with the friction. Previously, I could not get the lateral values (post: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7906)

Examining through btSequentialImpulseConstraintSolver, I understood how to update
friction values. It's interesting to learn how these variables work.

Now I can get the friction force, but still, I cannot understand regarding it's order.

When you look down into adding friction constraint sequence in btSequentialImpulseConstraintSolver, you can see that m_lateralFrictionDir2 is added prior to m_lateralFrictionDir1. With this order, after in resolve sequences, m_appliedImpulseLateral1 is set by the value which was computed from m_lateralFrictionDir2. It means, if you want to use friction direction and magnitude from outside, you should use m_lateralFrictionDir1 with m_appliedImpulseLateral2, and vice versa.

It was quite confusing, and I took a look through the functions of btSequentialImpulseConstraintSolver to verify the problem. I'm not sure if that is intended or not, but if it needs to be fixed, then just changing addition code should be enough.

for example, inside convertContact:
Code:
if (!(infoGlobal.m_solverMode & SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION) && lat_rel_vel > SIMD_EPSILON)
{
cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel);
if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS))
{
cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB);
cp.m_lateralFrictionDir2.normalize();//??
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
}

applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
cp.m_lateralFrictionInitialized = true;
}

after changing order of adding constraints:
Code:
if (!(infoGlobal.m_solverMode & SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION) && lat_rel_vel > SIMD_EPSILON)
{
cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel);

applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);

if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS))
{
cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB);
cp.m_lateralFrictionDir2.normalize();//??
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
}

cp.m_lateralFrictionInitialized = true;
}

Top

 Post subject: Re: Friction direction and impulse problemPosted: Mon Apr 23, 2012 3:20 pm

Joined: Mon Apr 23, 2012 2:57 pm
Posts: 2
Hi,

I had similar problems like you had. First I was not able to get the lateral components of the contact impulses. First I applied the solver flags and the values are updated now.

But even if I follow your advise concerning the changes in the code of Bullet, I can't manage to get proper results for the friction force applied to the body. I inserted a debug output for the values of m_appliedLateralImpulse1 and m_appliedLateralImpulse2 but these values change all the time as if they are integrated or they accumulate some values. In my example (10° inclined plane and a body on it) the value for m_appliedLateralImpulse1 change from 0.20 to -0.20 over a period of approximately 30 seconds and than keep that value. I did some analysis of the btSequentialImpulseConstraintSolver.cpp without finding something that helped.

Did you manged to get proper values for friction force? Or did anyone ever?

Regards,
anyway

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: c6burns and 6 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities