What you're looking for is broadly classified as Multibody Dynamics. You can model each part individually and connect them to make a complete simulation. There are two parts to building these types of models:
1. IDE and Language - Modelica, ADAMS, Project Chrono, SimScape etc. There are open source and commercial solutions for this.
2. Libraries - Claytex, Modelon etc. most detailed vehicle models and components are sold separately. These are typically written in Modelica. Some IDEs like MapleSim or Mathworks bundle it in their IDE.
You can build your own components from scratch but it takes time.
The closest to open source I found is: https://sbel.wisc.edu/2018/07/23/chronovehicle-template-base...
https://github.com/projectchrono/chrono
If you want to learn how to do it properly, you can easily find online versions of this book: https://www.elsevier.com/books/the-multibody-systems-approac...
What is missing from Torcs? It looks like a pretty good place to start, it has independent wheel modeling, and suspension, and mass shift of the car (I suspect it can handle mass shift of the driver if that’s what you’re after).
You can probably model frame deformation yourself by building a frame in a physics engine out of flexible parts and/or joints, but I’m skeptical that it’s worth the effort when modeling indoor karts, I’m not sure they flex enough to matter, but it depends on exactly what you’re trying to do.
The car physics my team built was made on top of the Bullet physics engine, so Bullet handled integration and collision dynamics, and we added transmission, braking, suspension, wheels, etc.
It’s definitely worth asking yourself how good you need the simulator to be, and how serious you are about this. It’s a multi-year project to get something “good” and/or better than Torcs. I would tend to agree with their answer to the FAQ question “should I start my own racing sim project?” http://torcs.sourceforge.net/index.php?name=Sections&op=view...
Flexing frames maybe overkill, you seem better placed than me to estimate that.
The FAQ answer address the difficulty of running an OSS project. It doesn't address the difficulty regarding the physics (which, I understand, maybe even more mindbending).
This is a hobby-level project. Nothing serious. I'm more interested in understanding the maths and physics. Having watched hundreds of races (my kid drives), I've seen behaviors which are pretty specific to karts (I guess). For example :
- driver mass shifts do matter (pilots constantly use them)
- karts jump when taking corners too fast and too tight (they usually slide, but when it's too much, they do jump, and decelerate...)
- turning wheels left/right very fast is used to brake during pit stops.
but you're right, I may be out of my league here :-)
The other thing I’d add is that the physics models is only half the battle. The car and track geometry is critical to making an accurate simulation. It’s easy to get wrapped up in the car physics and forget to deal with the angles and bumps and materials and temperature of the road surface.
Cameras are huge too, if you do anything other than a fixed interior cam. A naive follow can behind a car can totally undo all the physics.
Good luck!!
So I completely agree, and I guess this FAQ answer is really meant to talk to the casual developer who doesn't know what they're getting into. The person who does know and does it anyway will (and should) ignore stuff this like. I don't think it was meant to be condescending, I took it more as a joking tone but with a real warning that it's a long road, which is true.
https://assetstore.unity.com/packages/tools/physics/edy-s-ve...
this is a good starting model https://github.com/spacejack/carphysics2d
I wrote an extension for it that handles loss of traction, power drifting and mapped terrain friction that I can share, it's all mit licensed after all, but it's in Java, it's simple enough to port it whatever language you want because it's just math primitives
Simulating this is what interests me because it seems absolutely non obvious.
As said by someone else, maybe I'm looking at a problem that his out of my reach (my physics skills are rather weak). That is, I have no idea of how that happens.
I'm not a physics person either, but wheel hop seems to occur when the force overcomes friction between tire/track, causing an oscillation between grip/no grip. It is a lot worse on vehicles with suspension, because they have more give.
I find it easier to visualize with a car, because it is more pronounced. Although with a car it is usually occurs on a standing start, whereas with karts it is a lateral force thing.
This karting forum suggests high center of gravity contributes to wheel hop.[1]
[0] https://www.paradigmshiftracing.com/racing-basics/how-karts-... [1] https://4cycle.com/karting/threads/wheel-hop.87876/
But simpler games model cars pretty well, I’m assuming with a dozen or so parameters (turning radius, acceleration, tire grip, suspension..) you should get something. The “pako ios car simulation” (not open source), has a bunch of cars you drive around that behave more or less like actual cars.
I've checked the source code of torcs but it seems quite simple (although the results are very convincing).
My goal was to model a (indoor) kart.