Make 3D games with real physics.
A small JavaScript engine for the web. A few lines of code, and things fall, bounce and swing.
This is the engine running, not a video.
Open this scene in the sandbox
Pick a demo and run it
Every one is a short sketch. Open it in the sandbox to read the code and change it.
Short enough to read in one go
There is no loop to write and nothing to import. You write the functions the engine calls, and use a few globals.
setup()Runs once. Make your starting scene here.update()Runs 60 times a second. Read the keyboard and the mouse, push things around.Cube,Sphere,Floorand friendsEvery one is aSolid: it can be seen, it can fall, and it can be touched.
function setup() {
world.gravity.y = -10; // gravity starts off. Turn it on.
new Floor();
const box = new Cube(0, 4, 0);
box.color = 'tomato';
box.bounciness = 0.6;
}
function update() {
// Space blows everything away from the middle
if (kb.presses('space')) world.explodeAt(0, 0, 0, 6, 8);
}
What is in the box
Six shapes, your own hulls and meshes, joints, forces, ray casts, cameras, lights and a flat layer for scores. Each page of the docs has demos you can run.
What it cannot do yet
spaSHial is young. These are not built, and the docs say so in one place.
- Textures and sounds
- Models from files (glTF)
- Online multiplayer
- Saving a game's data
- Vehicles and ragdolls
- Terrain from a height map