Adam's Lair Forum

game development and casual madness
It is currently 2020/06/06, 21:17

All times are UTC + 1 hour [ DST ]

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2013/05/23, 15:54 

Joined: 2013/05/20, 17:19
Posts: 77
Role: Professional
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?


PostPosted: 2013/05/23, 19:18 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
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:
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.


Blog | GitHub | Twitter (@Adams_Lair)

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]

Who is online

Users browsing this forum: No registered users and 3 guests

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

Jump to:  
Powered by phpBB® Forum Software © phpBB Group