Friction and stability.

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Friction and stability.

Postby PJani » Sun Sep 19, 2010 11:57 pm

Hy. I have one physic-programming question.

While i wait for newton multibody vehicle to become more improved. I started playing with 2d top-down physics.
I have trouble with implementing angular friction. If i understand right some "friction" negative torque exists which causes objects to stop rotating, the problem is i dont know how to implement it. :roll:

This is how i implemented sliding friction, just an example.
Code: Select all
float earth_gravity_accel = 9.81; //m/s^2

float object_mass = 1000.0f; //kg ~ m
float object_friction_with_ground = 0.9; //scalar unit ~ k

float object_gravity_force = object_mass * earth_gravity_accel; //N ~ Fg
float object_friction_resistance = object_gravity_force * object_friction_with_ground; //N

Vector2 ext_force = ....; //some applied external force

float force_result = .0f;

float ext_force_magnitude = external_force.length();

if(ext_force_magnitude>object_friction_resistance)
{
   force_result = external_force.normal().scale(ext_force_magnitude-object_friction_resistance);
}

applyForceToObject(force_result); //just some function
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Friction and stability.

Postby JernejL » Mon Sep 20, 2010 3:52 am

If it's about tires, then you probably mean lateral and longtitudal friction?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Friction and stability.

Postby PJani » Mon Sep 20, 2010 8:29 am

i mean generally. for all objects...
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 46 guests