Just a quick question: is it technically possible to implement skidding/sliding using the VehicleControl? I mean, something like if the player drives fast and then turns hard, and the car moves slightly sideways for a small time before slowly moving exactly forwards again. I just want to check if this is even possible before I spend a while tweaking the physics values. Thanks!
Yes it’s possible, but not directly by setting values and walking away. It can be simulated, though. Something like calculating the g-force invoked (direction * speed * scale for example) and setting the wheel friction accordingly. So if you turned full lock at 180mph you would just keep going forward. If you gave the rear wheels less friction than the front you would “skate” sideways. It begins to get complicated from here. Torque for example. FWD vs RWD vs 4WD vs AWD.
Bullet provides all of the necessary ingredients but you have to abstract things away into components. A gearbox, an engine, a tyre, etc. Engines have torque graphs where they have the most “oomph” at certain revs.
You can make a full-on simulation if you understood the maths.
If you gave the front wheels slightly more friction than the rear and scaled the friction down as the speed increased you could probably just fake a quick demo with a few lines of code.
Thanks for your advice. Tweaking the setFrictionSlip() values seems to cause the effect I want, although I’m having trouble avoiding the car getting into a tailspin. I think I just need to keep tweaking.
I managed it with changing tyres friction when pressing the accelerator. I know, sometimes it’s not correct with the real physics, because you always lose a bit of friction in straight way when you press the button, even in the high speeds when in real it is almost imposible. The pros are that you can control friction for example; of the rear tyres. If you slide in big angle, you just release the accelerator, decrease the angle of slide and then again go full throttle. You can make nice long drift with the car but you need to give that car slightly more power too.
That doesn’t sound so unrealistic.
Tire “grip” is controlled by the accumulation of several inputs… but that definitely includes acceleration and deceleration. If you accelerate, at any speed, the overall grip of the tires goes down (say for cornering). Same with braking. That’s why it’s better to brake before the turn.