Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by Dave Gravel » Fri Mar 08, 2019 12:15 am
In my editor I can change the default world material in runtime.
When I change the material friction all work good.
NewtonMaterialSetDefaultFriction(FWorld, FMaterialID, FMaterialID, FStaticFriction, FKineticFriction);
The problem start when I set the material friction to zero.
All work as supposed the body don't get any friction but If I try to change the friction again the value is not take in count it stay always at zero.
When the friction is set at zero it is locked with this value and you need to destroy the world to get it back.
I don't have test if it happen with Softness and Elasticity properties.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Sweenie » Fri Mar 08, 2019 6:54 am
It seems Newton disables friction all together when you set it below a certain value, but when you set a new higher friction value the friction is not enabled again.
in dgNewton/Newton.cpp (void NewtonMaterialSetDefaultFriction...)
- Code: Select all
if (staticFriction >= dgFloat32 (1.0e-2f)) {
dFloat stat = dgClamp (staticFriction, dFloat(0.01f), dFloat(2.0f));
dFloat kine = dgClamp (kineticFriction, dFloat(0.01f), dFloat(2.0f));
stat = dgMax (stat, kine);
material->m_staticFriction0 = stat;
material->m_staticFriction1 = stat;
material->m_dynamicFriction0 = kine;
material->m_dynamicFriction1 = kine;
} else {
//material->m_friction0Enable = false;
//material->m_friction1Enable = false;
material->m_flags &= ~(dgContactMaterial::m_friction0Enable | dgContactMaterial::m_friction1Enable);
}
This line disables it but it's seems to be missing code to enable it again.
- Code: Select all
material->m_flags &= ~(dgContactMaterial::m_friction0Enable | dgContactMaterial::m_friction1Enable);
-
Sweenie
-
- Posts: 498
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by Dave Gravel » Fri Mar 08, 2019 12:01 pm
Exemple:
https://www.youtube.com/watch?v=0W0c8pdXERsEdited:
0.01 is the minimum that I can set if I like to change it again.
I have fix my problem by setting a limit to 0.01 on my editbox.
When you use value lower that 0.01 the problem start to happen, Sometimes after have set the friction to zero when I try to back at the normal it give me a error.
It don't happen all times.
-
Dave Gravel
-
- Posts: 800
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 6 guests