Skip to main content
GameDev.net gamedev.net
🔒 Locked

Friction vs. Torque

Started by Drilian Dec 24, 2004 at 11:43 PM 2 replies 6.3k views
Original Post
Drilian
Drilian
So I have a program where, ideally, I can roll a ball around by applying a torque around the axis. So I have two functions: EDIT: It should be noted that "^" is my cross-product operator.
void AddForce(const CEVector3 &f, const CEVector3 &point)
{
  m_forces += f;
  m_torques += (point - m_center) ^ f;
}
 
void AddTorque(const CEVector3 &axis, float amount)
{
  m_torques += axis * amount;
}
Adding torque about the axis (Through the center of mass, always) doesn't affect the linear force (consider it two forces on opposite ends of the sphere, pointing in opposite directions orthogonal to the axis of rotation) I currently assume an infinite coefficient of static friction (no slip. Ever.) So to get the amount of friction to apply, I need to know how much force is being applied tangentially to the surface:
CEVector3 GetForceAtPoint(const CEVector3 &pt)
{
  CEVector3 dir = pt-m_center;
  return m_forces + (m_torques ^ dir) / dir.LengthSquared();
}
So this gets the force at a given point on the ball (I'm doing points instead of radius because I'm going to generalize this for non-ball objects eventually). I can't remember the logic behind how I came to that little equation, but it seems to do the trick. So the friction pushes back on the ball in the opposite direction at that point. However, if I simply call:
AddForce(-GetForceAtPoint(pt), pt)
the ball moves the correct direction at the correct speed, but the addition of the force cancels out the rotation. Now, if I only apply the force to the linear force (it doesn't affect the torque, or it's not added to m_torques), then it works correctly. Either I have a concept wrong, or this friction really shouldn't affect the torque. Can anyone explain this to me? I'm immensely confused. [Edited by - Drilian on December 25, 2004 12:13:34 AM]
Dredge-Master
Dredge-Master
not sure how you are working everything out, but the coefficient of friction ranges between 0 and 1 inclusive. You can't have an infinitly large cof.

Anyways, friction forces will vary depending upon the force normal to the surface. I don't think that you are including that in your program. You may want to if you are creating a generic one.

I had some code I wrote a few years ago (I'm in mech. eng.) to simulate this, but I have no idea if I still have it, and at the moment it's 5:43am Boxing Day so I can't quite make out what your scenario is for this problem (ie I can't understand what you are saying due to lack of sleep). If I remember to check this thread later, I will.
Beer - the love catalystgood ol' homepage
Drilian
Drilian
Actually, the static frictional force (and I'm using static friction because the bottom of the ball is not moving relative to the ground (no slipping) so there's no kinetic friction, only static) is only as strong as the force being applied tangentially to the object (if I'm pushing a box across a table with 5N of force, and the box doesn't move, then the friction force is 5N in the other direction...if I push with 10N of force and the box doesn't move, the friction force is 10N...up to the maximum defined by the normal force and the coefficient, of course). So by "infinite coefficient of friction" I mean that the static friction will ALWAYS prevent the object from moving, because the frictional force will always match the tangential force being applied to the object.

Also, I think it's possible to have coefficients that are greater than 1...at least, according to this page: http://www.carbidedepot.com/formulas-frictioncoefficient.htm

The maximum amount of static friction that is applied varies based on the normal force to the object, but since the maximum amount of static friction that I allow is currently infinite (I know this is inaccurate but I wanted to get static friction working before I started allowing slip and kinetic friction), it only varies according to the amount of force being applied tangentially. But I've said that before in this post already :)

And currently, the AP is right. The ball will translate because of the force on the center of mass, but the torques cancel out so it no longer rotates. But a ball in reality still rotates...the applied torque does not get (entirely) cancelled out. Why is it, then, in my program, that it DOES get cancelled out? The ball ends up sliding along the table without rotating at all, and it's rather wrong.

All I'm trying to do is get static friction to prevent the object from slipping (point that touches ground does not move), but still allow the object to rotate and roll. And it's driving me nuts :-/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.