Friction not working correctly

I can't think of any sensible reason this will happen.

I am making a platformer, and want to get a more "oldschool" movement feeling - constant velocity, not slipping on angled surfaces, and simple jumps.

I tried a whole lot of ways to achieve that, none of them working decently (closest one being a wheel underneath the player, with the controls directly setting angular velocity).
Then I stumbled upon this Box2DAS3 code that achieves what I want.

I did an exact port to my C++ code, and yet the friction isn't working correctly.

Even though the friction is set correctly to 0, 0.2 and 100, when in air, walking or standing for some time respectively, the
player never acts as if its friction is set to the specified values.
He doesn't stop immediately, and he slips on angle surfaces (no friction = 100).
Only if I comment both friction = 0 and 0.2, does it actually set it to 100.

Again, the function calls are being called correctly, and I can't see any reason for this behavior.

This is the relevant code, with std::couts to check if the calls are called:
Code:
if ((!keyboard[sf::Keyboard::A] && !keyboard[sf::Keyboard::D]) || (keyboard[sf::Keyboard::A] && keyboard[sf::Keyboard::D]))
{
   stillTime += deltaTime;
      
    m_body->SetLinearVelocity(b2Vec2(v.x * 0.9f, v.y));
}
else
{
   stillTime = 0.0f;
}

if(!m_grounded)
{
    std::cout << "0 " << rand() << "\n";
   m_physicsFixture->SetFriction(0.0f);
   m_sensorFixture->SetFriction(0.0f);
}
else
{
   if (((!keyboard[sf::Keyboard::A] && !keyboard[sf::Keyboard::D]) || (keyboard[sf::Keyboard::A] && keyboard[sf::Keyboard::D])) && stillTime > 0.2f)
    {
        std::cout << "100 " << rand() << "\n";
      m_physicsFixture->SetFriction(100.0f);
      m_sensorFixture->SetFriction(100.0f);
   }
   else
    {
        std::cout << "0.2 " << rand() << "\n";
        m_physicsFixture->SetFriction(0.2f);
      m_sensorFixture->SetFriction(0.2f);
   }
}

Thanks for any help.
When two fixtures get close to each other a b2Contact is created to manage any potential interaction between them. The info from the fixtures (eg. friction) is copied into the b2Contact, and the original values in the fixtures themselves are no longer referenced for that contact. To make any changes of the kind you are wanting, you'll have to change the friction values in the b2Contact rather than the fixtures. You can do this in any of the contact listener functions, as they all pass the b2Contact to you. b2Contact has SetFriction and a few other functions which will come in handy for this kind of customization: http://code.google.com/p/box2d/source/b ... 2Contact.h
You might also find this useful: http://www.iforce2d.net/b2dtut/collision-anatomy
I can't explain why the Flash version works as it does... perhaps the port has done things a little differently about this.
Thanks! You just saved me hours of headaches.

Original thread: https://box2d.org/forum/viewtopic.php?t=8686