here is lesson two, and this one is not so much for David but for the othe people.
I know it is very tenting to use cylinder or even convex hull shape for tires.
but this is a huge mistake for multiple reasons.
reason one, all macro tire model are base of a tire having a contact point and a contact patch.
It is not until you get to finite element analysis that a tire contact path is model by using few solid pieces in contact with the ground but that is no what we do.
any tire model is base of the following assumption.
1-The tire contact the ground at one point.
2- the tire form a contact patch with the ground that ground the point
3-experiment show that teh side and the pressure on teh pat is proportional to the tire load.
4-It is assume the as the tire start to move some point remain in contact with the ground while some lose the contact.
5- a density distribution is assume teh load over each tire point in teh patch and in the simple brush model is assume to be uniform,
6- the integration of this density determine the ration of point that lose contact to teh point that ar still in contact yeild the tire sleep expression
longSleep = (wr - v)/v and side sleep = vx / vy
with this expression teh tire capacity for longitudinal, lateral and aligning torque can be derive and there are several model for this.
teh secund reason is that say you use a cylinder becaus you think is more accurate, what you get is contact that in most case do no pass but the center of mass of the tire but that instead will be an offset for the tire origin. the will generate an off torque of the vehicle that will add zero contribution to the vehicle vahavior, it will put a lot of stress of the solver for calculate such small offset in teh present of mostly large forces.
and if you do not believe just think what happen when you have misaligned tire in your car, you car steer to one side, teh tire vibrate, and you tire get worm more that they nee to.
well this is the effect that off torque does if you use a shape thet produce off contacts all the time
for that in newton we have the ChamferCylinder, this shape resemble the way old tire were made, they look like a toroid, just look it up in google.
thsi shape give all the benefic of a cylindrical tire and also allow to get the single contact for the tore model whi is based on a single contact point, tire load and friction coeficent.
the secund part is that with an arbitrary with and radius is has to make a change cylinder tire to look good. it is even possible that teh dimensions do not define a shape.
for that what I do is that I made a unit tore shape, and them I apply a no uniform scale that map it to the desired size and width, and sine ther is no a signofoca penalty fo non uniform scale in newton, this work quiet well.
her is the code snipe to do that.
- Code: Select all
// lesson two use a unit CreateChamferCylinder and scale it instead of a variable size one.
//NewtonCollision* const collision = NewtonCreateChamferCylinder(world, tireRad, tireHeight, 0, NULL);
NewtonCollision* const collision = NewtonCreateChamferCylinder(world, 0.5f, 1.0f, 0, NULL);
NewtonCollisionSetScale(collision, 2.0f * tireHeight, 2.0f * tireRad, 2.0f * tireRad);
again this are just optimal best practices, but I do recommended you follow them because vehicle are stiff systems that are hard to keep stable and it is eassy to get over impresses with preliminary result and teh moment you try to drive you get the disappointment.
so the last you wnat to do is adding the possibility of bad force that get amplified out of control with high speed.
In Dave demo I commiet that secudn change in funtion crate tire.
nwo I will move to teh next step to complete the model.