Hi !
I'm glad to read an answer to my topic
So i guess the new subject is "how to make it both physics-based and and fun", eg : have some sort of NFS cornering style. Or at least GT with a very controlable car.
The Pacejka MF, takes KILO NEWTONS as input load, so your 1N is actually 1000N!
Thanks for the precision
I was twiddling with stability and controlled drifting and such in the weekend and realized that the weight transfer has significant importance in cornering and control, which makes sense, but also confuses me why anti-roll bars help stabilizing in corners
Yes, i realized the same thing. I have come to the conclusion that physics-based car SHOULD implement some sort of weight transfer, as ultimately every force get scaled by weight transfer.
For anti-roll bars, their main effect should be to prevent the car to roll in high speed cornering ; in 3D physics, if you generate a lot of lateral forces during cornering, the car inertia makes it want to roll : http://www.euclideanspace.com/threed/games/examples/cars/cornering/car2cornering.png
I think from a 2D point of view, that anti-roll bars will help to prevent too much weight to go left/right of the center of mass during cornering too, which can have some effect in tires grip. Altough, i have read, lateral weight transfer is generally a good thing, as it gives more grip to the tires who needs it. But it must become a bad thing past some critical ratio value i guess.
What i can tell you is what i know (almost) for sure abour car control. In a so primitive state as we are, the things that would tend to have the more effect on the driving feeling would be :
- The wheel friction (long/lat, etc)
- The wheel springs (weight repartition entirely relies on them)
- The control system intelligence (without intelligence even a very fun/arcade car might be unplayable without very carefull throttle/steering management from the player)
I feel like we are more at step 1. Successfully going to step 2 might be quite complex, and maybe we should do some arcadish algorithms to handle weight transfer and its effects the way we want it before blindly implement yet another "real life" physics formula.
I realized those past days that input post-analyzing is maybe even more critical that correct lateral/long forces implementation. If you look at almost every car game, at high speed the wheel is steering of 2-3° against 45° at very low speed. Some games calculate the peak of lateral grip to prevent the player from going besides grip peak. Same goes for front/brake inputs.
It's not ESP or anti lock system at this point, it is more like the driver "listenening" to what the car he is sitting in has to "say". I'll try to come up with some formula to calculate max steer angle in real time to see how much it helps during cornering.
Without weight transfer my car was incredibly unstable at high speed (>100km/h), even with a very small (2-3°) steering angle it spun around instantly.
What kind of lateral friction do you apply ? Because i tend to have some sort of controled lateral drift quite easily with :
a) no weight transfer
b) a linear force returned for cornering forces : slipAngleInRadians * 5 for example (with a 1500kg car, so it is around 3500N for each tire)
[media]
[/media]
I shooted this video to show you what i am saying.
Without weight transfer, i tend to have this behaviour when the lateral forces curves & weight load are == for the 4 wheels. With "real" pacejka curve, i get a lot of understeer after the peak, so i have to limit the steer angle of the wheel.
Sorry for the low framerate it is actually smooth and nice to see (no teleporting). I'm recording with VLC which gives me a not that good framerate.
---
Adding rear/front (no lateral) weight transfer i get :
- Great instability if turning + braking. Note that braking occur naturally because of front wheel lateral friction, "natural" air/roll friction, + eventually real driver input braking. Anyway, my car spins really fast even with a very small amount of weight transfered from the rear to the front.
- Increased understeer effect during high speed cornering, especially if i do not limit steer angle.
- Theorically controled drift could happen, but in reality car spins way too fast for the driver to have any time to react. Even in slow motion, if you have time to react, the situation evolves too quickly. But the physical facts & consequences are not illogical to me.
---
I don't know if my experience is helping or confusing you. (helping, i hope).
I remember using 5% more traction (linear *1.05 multiply) for front or rear wheel train, successively. More grip to rear = understeer and more grip to front = oversteer. Nice to play with without weightload, but as soon as weight get transfered it makes turning even more catastrophic.
My intuition here tells me, the great yaw velocity comes from the lack of balance between front/rear tires lateral response. *1 or *10k is not very important as long as everything scales at the same time. If the lateral force balance comes to F70%/R30%, for example, the car will do spin turns very fast.
When i analyse those ratios at the times the car seems to be in a small oversteer situation (which is a feeling players tend to like), the front wheels quickly (almost instantly) goes from 90% to 51% of the total generated lateral forces in early cornering. If you want to prevent the car to spin, the lateral force of the rear wheel must quickly go over 50% to keep the car heading controllable (in the above video example, the rear wheels go to 51% of the total lateral force generated to "counter" oversteer). So, looking at the problem from this perpective might help you to adjust parameters to stabilize things. It helps me to think clearly at "what i want", anyway.
I know we can use different traction circles/curves for front/back tires, but i have seen very nice drifting behaviour in Edy's car physics which seemed to apply the same curves for every wheel. So i would (will) try to get drifing whithout messing with this for now.
---
Actually i am wondering if lateral weight transfer could greatly influence the wheels in the outside of the turning lane, in a maner that would add more stability to car yaw, and eventually help us to get a nice turning feeling. What is your feeling about this ?
---
Adding some load transfer helped, but it was still oversteer without throttle. With throttle it was just understeer, but no inbetween... So I cannot play with brakes and throttle to control drifting
Same thing here. Worse : if i try to limit traction circle to have throttle/braking to allow for controled drift, i go from normal high speed understeer (due to high speed, despite small deceleration) to instant oversteer because throttle consume too much traction budget. I have the feeling i want the 100% operating range of my drifting to be limited to a very small range of force difference.
Looking at Edys vehicle physics curves in real time, i learned you can saturate front wheels without starting to spin instantly. I still have to figure out if that is dued to springs, more complex formulas, or to input control and magic things.
---
My weigth transfer formula is:
W=m*GRAVITY
Wf=(c/L)*W-(h/L)*Fx
Wr=(b/L)*W+(h/L)*Fx
Here is mine , it looks to be the exact same. Anyway, weight transfer is quite easy to check from real life data available on internet. The problem does not lie in the raw calculations rather in the fact that spring must have a great influence on that, too (i guess).
[spoiler]
updateAxleLoad = function (forwardAcceleration) {
var newWeightLoad = 0;
// Gravity center height
var cgHeight = this.car.cg.h;
// Distance between front/rear axle
var distanceBetweenAxles = this.car.cg.b + this.car.cg.c;
// Distance between actual wheel and gravity center
// TODO : calculate REAL distance (wheels are not centered in axles, rather on the car sides, so we should use pythagore)
var distanceToCenterOfGravity = 0;
if (this.wheelId == WHEEL_FRONT_RIGHT || this.wheelId == WHEEL_FRONT_LEFT) {
distanceToCenterOfGravity = this.car.cg.c;
} else if (this.wheelId == WHEEL_REAR_RIGHT || this.wheelId == WHEEL_REAR_LEFT) {
distanceToCenterOfGravity = this.car.cg.b;
}
// We need ratio cgHeight/distanceBetweenAxles to calculate mass transfer
var h_by_L = cgHeight / distanceBetweenAxles;
// Mass of the car
var totalCarMass = this.car.m_mass;
// Planet gravity
var NEWTON_GRAVITY_CONSTANT = 9.81;
// Weight of the car on the planet
var totalCarWeight = totalCarMass * NEWTON_GRAVITY_CONSTANT;
// Static wheel load (without acceleration)
var staticLoad = (distanceToCenterOfGravity / distanceBetweenAxles) * totalCarWeight;
// Dynamic load due to car acceleration
var dynamicLoad = h_by_L * totalCarMass * forwardAcceleration;
// Taking care of acceleration sign for weight increase/decrease
if (this.wheelId == WHEEL_FRONT_RIGHT || this.wheelId == WHEEL_FRONT_LEFT) {
// Front wheels get less weight with more front acceleration
newWeightLoad = staticLoad; - dynamicLoad;
}
else if (this.wheelId == WHEEL_REAR_RIGHT || this.wheelId == WHEEL_REAR_LEFT) {
// Front wheels get more weight with more front acceleration
newWeightLoad = staticLoad; + dynamicLoad;
}
// The weight was for the axle, now we devide it by 2 for individual wheel weight
this.m_weightLoad = newWeightLoad /= 2;
[/spoiler]
---
For 4 wheel weight transfer, I'm not sure if this is the right thing to do:
Just transfer along axles based on lateral acceleration.
Fz_front_left=0.5*Wf+(h/Track)*Fy
Fz_front_right=0.5*Wf-(h/Track)*Fy
...the same for the rear wheels...[/quote]
I was going to do the same thing. You can indeed get lateral weight transfer the exact same way you get front/rear. The problem is you have 2 differents values for 4 wheels, so it is 8 values. How do you combine that ? I was thinking about this :
For example :
- static load = 3500N / wheel
- front/rear load = 4000N front / 3000N / rear (decelerating)
- left/right load = 5000N left / 2000N right (high speed turning)
- i think we SHOULD take care of angular velocity in lateral weight transfer, but i haven't looked into it.
So, laterally 42% of weight goes from right to the left.
And 15% of the weight goes from rear to front.
I would say it give me for the different tires :
- FL : 3500 + 3500 * (+0.42 + 0.15) = 5495
- FR : 3500 + 3500 * (-0.42 + 0.15) = 2555
- RL : 3500 + 3500 * (+0.42 - 0.15) = 4445
- RR : 3500 + 3500 * (-0.42 - 0.15) = 1505
Total weight = 14.000N, so =3500*4. I think this way the weight is what it is supposed to be. In my example, i have way more lateral acceleration than front deceleration, so the outside wheels should get way more grip with some oversteer due tu front having more traction.
I think those weight repartition values would produce very unstable car (yawspins), but i'll try it anyway.
---
Adding some jacking force helps a bit, but still not the result I expected.
F_jack=Fy*h_roll_center/(Track/2)
Fz_front_left-=F_jack
Fz_front_right+=F_jack
h_roll_center = roll center height from ground[/quote]
I'm not entirely sure how/why it helps, what do you mean by jacking force exactly ? I know it has something to do with suspension, but i havent really looked into in ATM.
I tried to divide weight transfer valye by 250, 500, 1000 to simulate "time to reach the calculated weight", it helps, but still, weight transfer has dramatic effects on behaviour.
---
Maybe I'm mixing up things, or should I implement a proper suspension model, where all spring and dumping forces do all the weight transfer and the formula above is not needed at all?[/quote]
I really don't know, and i really want to know ! As i said, suspension seems to be a critical part of how a car can be handled.
---
I was also playing with car settings, and it seems a front engine car (60:40 weight balance to the front) is more controllable than a mid-engined (40:60) which should not be.[/quote]
Be sure you are using the proper wheel distance to CG. If i have more weight to the front, the car easily align the front in the turns. Even when CG is only closer to front of a few cms, the effect is immediatly noticeable. As with traction, even a few % changes have great consequences.
AFAIK, front engine cars are easier to handle, as they can easily turn compared to rear-mounted engines car which can be tricky to handle during oversteer situations as the back of the car want to go to the front (easier car spins). So i guess you're experiencing something which is good.
But with unstable car turning due to a few % changes in repartion of mass, if you are braking with a front mounted engine, you will obtain even wore oversteering.
---
In facts, all those things leads me to think that my main problem is the effects so small ratios changes are producing. Dramatical effects. Everything should be WAY more stable even with poor wheels/suspensions systems.
So the right question is what should i do (maths shortcut or real physics) to improve my car stability... ?
My currently strategy is :
- Intelligent analysis of player inputs (ideal max steer angle/throttle ...)
- Gently decreasing force when coming closer to traction circle edge (when i'll re-introduce it)
- Try lateral weight transfer to if it improves/worsens car handling during high speed turns
- Maybe add a "time to build up" to generated forces. I have read, in reality a tire can take 250ms to really produce the max force it can bring. But i'm afraid it will do counterbraking and such things totally impossible to handle.
Extreme measure i might try if results are not good enough in a few days :
- Directly rotating velocity vector of the car in some situations (i have to define situation+angle, help can be brought by KJM as it seems he is doing it in his game)
- Limitating max torque / angAcc / angVel of the car
- Artificially prevent car spins (eg: if rear wheels go to 55% of lateral force + the car has some important yaw velocity, introduce some mechanism that would stabilize it)
- Limit weight transfer to a VERY small ratio
- Use a linear pacejka curve
I guess i'll have to implement proper springs/suspensions, but at this point i am not even close to measure the impact it would have on my simulation (good/bad, or more probably good, but not enough to make the game fun).
I'm very interested by your experience and future answers 