Adam's Lair Forum
https://forum.adamslair.net:80/

Friction clamped between 0 and 1
https://forum.adamslair.net:80/viewtopic.php?f=16&t=56
Page 1 of 1

Author:  BraveSirAndrew [ 2013/05/23, 15:54 ]
Post subject:  Friction clamped between 0 and 1

Hi again

Looking at the RigidBody component, the Friction property is clamped in the editor to between 0 and 1, but I know from using Farseer in other games that friction reacts appropriately all the way up to MaxFloat. Should this actually be restricted in the editor or is it an oversight?

Cheers
Andrew

Author:  Adam [ 2013/05/23, 19:18 ]
Post subject:  Re: Friction clamped between 0 and 1

Hi Andrew,

this was simply an oversight. Which I have fixed in my last commit, now allowing values between 0.0f and 10000.0f. My advice would be to stay mostly between 0.0 and 1.0, but you're no longer strictly bound to by the editor.

float.MaxValue seemed a little bit off, though. Consider the following code from Farseer that is used to mix two friction values:
Code:
public static float MixFriction(float friction1, float friction2)
{
    return (float) Math.Sqrt(friction1 * friction2);
}

I wouldn't want to bet on what happens when multiplying float.MaxValue with float.MaxValue, but I'd expect something irregular like Infinity or NaN - which are a dangerous kind because of their unhandy talent to spread through all math equations to which they are passed. Just for the record, that's why I'm still limiting the editor setting to a more reasonable range.

Regards,
Adam

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/