H
H
Hakito2015-12-17 15:43:10
Java
Hakito, 2015-12-17 15:43:10

How to simulate car physics?

Hello!
I am writing a game like Hill Climb, only I focus on the physics of the car, that is, the clutch, gearbox, everything is modeled. Movement only in a straight line, no slides.
How can I model the transfer of energy, forces from the engine to the wheels and vice versa, taking into account the clutch pedal?
It is desirable without the use of engines, since time is running out, but I work myself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Shumilov, 2015-12-17
@brusher

The implementation depends on your architecture.
I would implement using events and listeners:
press the "gas" button → update the power of the engine → it notifies the listeners: clutch → clutch looked at the gearbox and at the level of pressing the clutch pedal → passed its value to the wheels
and onUpadate (new frame) happens already calculating the speed of the wheels (based on the value obtained from adhesion, friction with the ground, air, etc.)
In this case, I like the system of events and subscriptions much more than counting everything at once on onUpdate, because you can complicate the system as you like and easily “pump” spare parts (after all, these are all different objects with different settings). Well, it will be easier to localize errors.
ps
I'm not a professional game developer, I'm just learning, and I would love to hear the advice of a professional who has a couple of successful games on his account :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question