Burning Rubber
by Ronald J Nelson · in Torque Game Engine · 01/23/2007 (8:25 am) · 1 replies
Is there some way to determine if the wheel is spinning out as in like a dragster taking off of the line? The value wheel->slipping is not it since it can tell me when the tires are slding under a few conditions but not during a spinout. I have my current code setup to place a rubber mark decal on the terrain during times of slipping. I notice that I cannot burn a complete "donut", only about half even thought it is clearly visible that the tires are spinning and slipping at all times while performing the manuever. However, if I put my car against a barrier so it cannot go forward and spin the tires, it leaves the mark.
I am guessing that there is a tolerance on what registers as slipping or not, but I am having a hard time finding it.
I am guessing that there is a tolerance on what registers as slipping or not, but I am having a hard time finding it.
Torque Owner Demolishun
DemolishunConsulting Rocks!
Here is the code that determines if the wheels are slipping:
// Longitudinal tire deformation force F32 ddy = (wheel->avel * wheel->tire->radius - yVelocity) - wheel->tire->longitudinalRelaxation * mFabs(wheel->avel) * wheel->Dy; wheel->Dy += ddy * dt; Fy = (wheel->tire->longitudinalForce * wheel->Dy + wheel->tire->longitudinalDamping * ddy); // Lateral tire deformation force F32 ddx = xVelocity - wheel->tire->lateralRelaxation * mFabs(wheel->avel) * wheel->Dx; wheel->Dx += ddx * dt; F32 Fx = -(wheel->tire->lateralForce * wheel->Dx + wheel->tire->lateralDamping * ddx); // Vertical load on the tire verticalLoad = spring + damping + antiSway; if (verticalLoad < 0) verticalLoad = 0; // Adjust tire forces based on friction F32 surfaceFriction = 1; F32 mu = surfaceFriction * (wheel->slipping)? wheel->tire->kineticFriction: wheel->tire->staticFriction; F32 Fn = verticalLoad * mu; Fn *= Fn; F32 Fw = Fx * Fx + Fy * Fy; if (Fw > Fn) { F32 K = mSqrt(Fn / Fw); Fy *= K; Fx *= K; wheel->Dy *= K; wheel->Dx *= K; wheel->slip = 1 - K; wheel->slipping = true; } else { wheel->slipping = false; wheel->slip = 0; }It looks like it accounts for both x and y frictional forces to determine the wheel->slipping variables state. I would suggest just looking at the Fy force to determine if the tire is slipping in that direction. However, it may be easier to determine each tires rotational velocity and compare that to the direction the car is moving. That way seems better to me.
Maybe somebody that understands the forces part better could explain a better way to do this.