With any of the publicly available vehicle code samples? I don’t know anything about vehicle physics so creating my own from scratch would be way over my head.
I’ve tried the Unity car tutorial example, yoggy’s buggy example, Jcar, and some of the ones on the asset store and I can’t seem to get it right with any of them.
They all seem to use the lowered center of gravity trick so they can basically never flip over, or flip over too much, depending on how you tweak it.
I just want a fun, bouncy, semi-unrealistic buggy that can flip over and get stuck on occasion, but still compensates a little.
If I had to pick one, I like yoggy’s buggy the best, but it uses raycast colliders for wheels and I am having a lot of difficulty setting it up on my own vehicle.
Just my two cents: If I recall correctly I76 and I82 and Smuggler’s Run generally made the wheels of the dune buggies larger than what they were shown as on-screen. It gave them a nice bouncy feel and made them relatively stable. The low center of gravity trick is usually used for vehicles that can do high-speed cornering, or in games that require the player to race at speed and therefore the vehicles need to be able to corner at speeds a lot higher than they normally would without spinning out, rolling over, or flipping due to a small bump in the road surface.
You can lower the center of gravity over time as the vehicle moves faster to make it more stable. You can also increase the suspension length but stiffen it up, or you can shorten the suspension length but make it softer. You can adjust the rate at which the steering responds to the player the faster they go by using a sliding filter to adjust the responsiveness of the controls.
Thanks! I’ll try some of that tonight.
I thought about lowering the center of gravity over time thing, or changing it when all the wheels are off the ground for a period of time so the damn vehicle could actually get stuck flipped over and not be like those children’s punching bags with sand in the bottom. I also thought about applying a constant downward force (in addition to gravity) that increased relative to the currentspeed/maxspeed of the vehicle.
I like the ideas about increased wheel size and suspension, I’ll check that out.
It’s been a decade since I worked on any driving games, so my memory is hazy, but I would recommend staying away from artificial down forces in non-custom game physics engines. The problem with a generic physics engine compared to a vehicle physics engine is that you are constantly having to do “weird shit” to make the generic engine behave itself; things like very low, below-the-ground, center of gravity, larger than life wheels, odd suspension setups, and such.