SkillAgentSearch skills...

Carphysics2d

Simple 2D car physics

Install / Use

/learn @spacejack/Carphysics2d
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

#Simple 2D Car Physics Sim

Demo: http://www.spacejack.ca/projects/carphysics2d/

This is a Javascript adaptation of the ideas found in Marco Monster's often-referenced car physics paper and demo. His original paper has been archived here. His demo code, written in C, was archived by a user on gamedev.net here (from this thread.) A Java version was archived here.

This Javascript implementation additionally borrows some ideas from Siorki's js13k 2013 entry which also credits Marco's original paper. Siorki added some nice extras like variable front/rear size and axle distance to centre of gravity, as well as adding the vehicle's angular velocity to wheel velocity.

I've attempted to write this demo so that the details of the sim are clear and easily hackable. You can run it with or without a web server by loading index.html in your browser.

See the Car.js source for the physics implementation, in particular the doPhysics method.

####Additional Reference

Brian Beckman's The Physics of Racing

####License

MIT

View on GitHub
GitHub Stars217
CategoryDevelopment
Updated20d ago
Forks30

Languages

JavaScript

Security Score

95/100

Audited on Mar 16, 2026

No findings