Skip to content

LittleJS 1.31.0 - Improving 3D Physics and Level Editors

Latest

Choose a tag to compare

@KilledByAPixel KilledByAPixel released this 20 Nov 03:20
· 2 commits to main since this release

This release is about polish. Since 1.30.1 the whole engine went through dozens of review passes, each one hunting for bugs and rough edges, and this is the result: hundreds of small fixes across 2D, 3D, input, sound, the UI and both level editors.

The biggest change you will feel is in 3D physics. Lifts, stacks of boxes, doors, slopes and pushed crates now behave the same way every time, whatever order the objects were made in. There are few new features this time, and no new demos; the engine is simply more solid.

New Changes

  • 3D lifts: a HeightMap, MeshCollider or VoxelMap moved by its velocity carries what stands on it, up and down
  • 3D solids: a stack of two or three boxes holds, riders stay on a moving solid, a body follows a ramp made of a turned box down, and a door that closes on a body against a wall never pushes it into the wall
  • A GLTFObject's color and transparent apply to the whole model, so a hit flash or a fade is one line
  • levelEditor.onRestart may be async, so a game that loads or fades on restart works with both level editors
  • The level editors hold the game still while open, zoom with a pinch on touch screens, and take key codes for a game's own keys; edit2D.setProperty writes an object's property from a game's own tool
  • engineIsFrozen() tells a plugin the game is held still, and uiSystem.isPressOverUI() tells a game a click was the UI's
  • readSaveData gives back a vec2, vec3 or Color where its default is one, and never hands out the default itself
  • A trackpad pinch reads as touchPinch and mouseWheel, as a touch screen's does
  • Faster: collision on a HeightMap takes about a third of the time, a MeshCollider raycast tests only the triangles along the ray, and CSG cuts are about twice as fast and no longer grow the mesh with each cut
  • Debug builds assert on more common mistakes, like 'space' for 'Space' and Ease.OUT for Ease.OUT(Ease.SINE)
  • The FAQ answers how to make a title screen, a menu and game over, how to pause, and how to animate a value with tweens

Breaking Changes

  • 3D: HeightMap and MeshCollider follow one slope rule. Ground steeper than an object's groundAngle is not stood or jumped on, and the body slides down it; a steep face taller than the body's step stops a move into it. A game with steep ramps meant to be walked raises the walker's groundAngle
  • 3D: two solids with mass trade momentum when they meet, as 2D's do, so a pushed crate slides on and a kicked ball rolls away
  • 3D: render3D.pick and engineObjectsRaycast3D give back a glTF model or prefab, not its part; hit.part is the part
  • A 2D object type made by an arrow function is called make(pos, properties), as 3D's is
  • mousePosScreen is half a pixel less than before, the number of the canvas pixel under the pointer
  • A Timer of a whole number of frames elapses on the frame it ends, where it was often a frame late

Fixes

  • A body that jumps up through a one way platform can no longer slip into a wall or through the floor
  • Bullets stop exactly on a tile's face and no longer freeze on a wall when they bounce
  • 3D cameras read input only while they drive the view, and hand the pointer lock from one to the next
  • The third person camera no longer shakes when the player walks back toward it, or sees through a mesh floor
  • A 3D level's sky, sun and fog no longer carry into the next level
  • The 3D level editor's undo is Ctrl+Z on AZERTY and QWERTZ keyboards too
  • Gamepads, the touch gamepad and a mouse on a touch screen laptop: many fixes to buttons left held
  • Sound starts paused on a page opened in a background tab, and a negative volume is silent
  • Box2D: an error, a setScene or a level rebuild from a contact callback no longer breaks the world
  • Many more fixes from the review passes since 1.30.1, see the changelog

Check out the latest on GitHub to see everything we've been working on!