Haha, I’ve ended up stuck in very specific bits of the vehicle physics rabbit hole, but am pretty ignorant about others.
In 2016 I couldn’t find a good monster truck game for my son, so I naively thought I’d make one.
I started with Edy’s Vehicle Physics, which is great, it’s cheap and the code’s clean and it you can set up and configure a drivable vehicle pretty quickly (although even though it’s pretty simple, there are still a bucketload of things you can fiddle with, so it was kindof daunting to 2016 novice me).
We’re using Vehicle Physics Pro in Exo Rally Championship, and it lets you configure everything. If you’re after realism, the VPP developer’s using it in some quite simulatory simulators and really seems to know his stuff & actually races IRL. I don’t race IRL, so I can’t vouch personally for the accuracy, but it seems to be working well in our game right now:) I’d’ve thought decent weight transfer would be necessary for any kind of realistic vehicle simulation. You could give the free VPP a go, if you haven’t already.
There’s a comparison of Edy’s products here.
Both products use the Unity/PhysX WheelCollider though, and while I guess it’s decent for non-stunt road driving (suspension still instantly “snaps” to the road surface, rather than elongating “gradually” like a spring would though), that single-raycast-based wheel collider is garbage for weird terrain or wheels that aren’t “protected” by the body/chassis collider (like monster trucks) or doing stunts (no proper monster truck wheelies </3).
So I’ve ended up using frictionless mesh colliders on PrismaticJoint springs for the wheels that present the same interface to Edy’s stuff as the Unity WheelCollider so he can deal with all the complicated friction & drivetrain stuff. Niko Stenberg suggested this to me, he’s awesome:)
Edy’s stuff takes care of nonsense like skating sideways for “no reason”, rotating around y, jitter and stuff.
I guess if you’re using joints, you’re doing something similar. I feel like the approach I’m using would let you separate sprung and unsprung mass. ArticulationBody seems far more forgiving with larger mass ratios than my experience of ConfigurableJoint. Our vehicle weighs ~2400-3600kg with 60kg wheels, although I had to crank the physics timestep & solver iterations (may be able to de-crank, haven’t revisited). I set my ArticulationBody hierarchy up with real-world values and it all just worked first time.
I think weight transfer should “just work”, if the centre of mass, springs & weight distribution are correct.
VPP gives you a tool for configuring the inertia tensor, which I think has an effect on weight transfer and handling generally. IIRC Edy says the one Unity computes for you is bad for vehicle behaviour. Certainly, using the VPP tool made my monster trucks much more lively.
The XRC rover has steering, toe and camber (toe and camber aren’t modifiable while driving right now, but probably could be).
Edy’s configured some huge and complicated vehicles with joints, and you can pay him to set up a vehicle for you in VPP, if you have enough real-world data, so I don’t know if huge trucks with joints are an impossibility (40 tons is 7x bigger than my monster truck, 10x bigger than the XRC rover). You can maybe cheat by dumping some mass into the wheels or articulation hierarchy:)
Problems I’ve had with Meshcollider/ArticulationBody:
Sliding the wheel mesh over bumpy terrain, both meshes are of course entirely rigid so you need to do trickery to get a smooth ride & prevent the wheels pinging up all over the place when you hit tiny bumps. I’m using a combination of a second set of springs to simulate tyre flex, and contact modification to give a bit of extra squish.
Most of the motivation for my approach was I needed “3D”/ “Volumetric” wheels, rather than raycasts, though; you maybe don’t, I don’t know.
Traversing “seams” between meshes can be awkward (not sure I’d recommend the default contact mod offset “fix”).
I’ve discovered, reported, and had some awkward/nasty bugs fixed in both ArticulationBody and ContactModification, so I’m not sure how much use they’re getting in the wild.
I’m still not sure what to do with sidewall-only contacts, like when the vehicle has a z-rotation of 90:)
Because WheelCollider can only present a single point of contact, that’s all I’m doing for now, but I guess ideally I’d be able to present, e.g., a ground-contact and a front-tyre-wall contact simultaneously, e.g., for backflips (backflips work OK rn though, so maybe I’ll leave it:).
I’ve no idea if the DOTS Unity Physics or Havok stuff will address any of this or be a better solution generally. None of it existed when I started out:)
PhysX 5.1 has some cool-sounding stuff that I’m sure would help (soft bodies?!), but I guess we’re years off seeing that in Unity</3.
Edit: We had to buy the “Enterprise Edition” source to use VPP with our custom wheel mesh collider. I think Edy has plans to make custom wheel colliders possible at “pro” level, but last time I checked it hadn’t arrived there yet. EVP comes with source anyway.