https://github.com/oseiskar/js-car
2D JavaScript car dynamics simulation
https://github.com/oseiskar/js-car
javascript physics physics-2d physics-simulation simulation
Last synced: 2 months ago
JSON representation
2D JavaScript car dynamics simulation
- Host: GitHub
- URL: https://github.com/oseiskar/js-car
- Owner: oseiskar
- License: mit
- Created: 2019-02-23T18:01:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-02T21:25:31.000Z (over 5 years ago)
- Last Synced: 2025-02-27T05:23:17.852Z (3 months ago)
- Topics: javascript, physics, physics-2d, physics-simulation, simulation
- Language: JavaScript
- Homepage: https://oseiskar.github.io/js-car/
- Size: 73.2 KB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JavaScript 2D car dynamics simulation
### Physics model features:
* auto-generated track
* collisions with the 4 walls
* basic static and dynamic friction
* air drag applied to the center of mass
* "arrow-key steering aids": velocity-based limitations to steering angle
and its change rateThe physics model is "as simple as possible": Frictional forces are applied to
two points: the center of the front and rear axle instead of the four wheels
separately. The car is therefore actually modeled more like a "motorcycle that
does not bank". This is the same as assuming a lot of symmetry between the
forces to the left and right wheel on each axle, i.e.,* no tire slip due to deformations
* no suspension
* no roll
* equal coefficients of friction*TODO*:
* brakes
* non-constant torque from engine
* noise### AI drivers
* PID control with a few tricks
* Route planning with an ad-hoc "rubber band model" (uses a web worker)*TODO*
* Physics-based controller (non-PID)