Well not actually, you just apply friction force of each metal object (were not now talking about collision model), you treat tank along with chasiss as one rigid body and apply rotational force on center of each surface/( metal tire part ) contact surface (torque) and you apply same to the center of mass cause you want to move the object.
However you need a damping function
To deal with NaN and imprecision
//needed to be fixed if is nan
inline void damp( vec3 * ptr, float amount, float epsilon)
{
(*ptr) = (*ptr) - (*ptr)/amount;
vec3 p = vec3(absnf<float>((*ptr).x),absnf<float>((*ptr).y),absnf<float>((*ptr).z));
if (IsNan(p.x)) p.x = 0.0;
if (IsNan(p.y)) p.y = 0.0;
if (IsNan(p.z)) p.z = 0.0;
if ( (p.x > 0) && (p.x < epsilon) ) (*ptr).x = 0.0;
if ( (p.y > 0) && (p.y < epsilon) ) (*ptr).y = 0.0;
if ( (p.z > 0) && (p.z < epsilon) ) (*ptr).z = 0.0;
}
inline void damp( float * ptr, float amount, float epsilon)
{
(*ptr) = (*ptr) - (*ptr)/amount;
if (IsNan((*ptr))) (*ptr) = 0.0;
if ( (absnf<float>(*ptr) > 0) && (absnf<float>(*ptr) < epsilon) ) (*ptr) = 0.0;
}
template <class type> bool IsNan (type f) { return (f != f); }
Using too little timesteps will crack the sim so you deal with it
damp(&vel, 10.0, 0.007);
damp(&AngVel, 10.0, 0.0005);
call that each frame before calculating new velocities/forces
damp here is really simplified, didnt have time to spend on figuring how forces react on each other (in my case skin and body drag etc for rotations) so damp damps each x by x/10.0 in this case aecond parameter tells when were close to zero so we actually 0 it so theres no crack
If need any more help like explaining how you apply everything just reply