You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LittleJS 1.27.1 - Faster Post Processing in Firefox and Physics Helpers
debugLineWidth and setDebugLineWidth(width): the width in pixels of the outlines debug shapes are drawn with, the physics boxes and the tile collision view among them, 2 as before, larger to make them easier to see
render3D.fogDepth measures fog by depth along the view instead of distance from the camera, and render3D.fogFadeStart / fogFadeEnd fade see through draws to transparent with distance, so a scene can melt into its sky instead of a fog color
getVelocityAtPoint(pos) on an object: the velocity of a point on it, its velocity and its spin together, so the tip of a spinning blade moves faster than its middle; a Box2dObject asks Box2D, about its center of mass
collideWithTile gets a third argument, isHit: true when the object overlaps the tile where its move put it, or a bullet's ray goes into it, and false for the places the physics only tries to find which side it hit, so a game can act on a hit once and ignore the rest
The Object Collect short: balls drifting through a square and a circle, colored by engineObjectsCallback while inside and counted by engineObjectsCollect, and a click pushes away the balls near the mouse
A debug build warns once when a game sets a child object's pos or angle, which its parent puts back every frame, naming localPos or localAngle to set instead
The example browser's Share button copies a link to the code as it is in the editor, crushed into the link with JSONCrush so nothing is stored anywhere; the link opens the example it was made from and runs the shared code
PostProcessPlugin and setShaderCode take a built in effect on its own, new PostProcessPlugin(postProcessVignette()), joining it with postProcessEffects as they would have needed; before, that failed to compile with an error about uv
emitter.finishCallback on ParticleEmitter and ParticleEmitter3D: called once with the emitter when it finishes, done emitting and its last particle gone, so a game can play a sound or start the next effect when an explosion is over; not when it is destroyed immediately, as a scene clear does
Box2D beginContact gets a fourth argument, impactSpeed: how fast the two bodies were closing along the contact normal as they touched, spin included, so a game can tell a hard hit from a graze; the Box2D Pool short's click goes by it
Fixes
PostProcessPlugin copies the frame into its texture on the GPU with copyTexImage2D instead of uploading the canvas, which Firefox read back to the CPU every frame; a game with a post process there ran several times slower, AstroBlast's glow at 7 fps where it now runs at 31
particleEffect's assert for an option it does not have lists the options it does, and names the one meant when only its case is off, emitrate for emitRate
The build scripts, the engine's and the starter, module and TypeScript examples', run their tools with node and no shell, so a file name can not run as a command; a data file with a space in its name no longer breaks the examples' zip, and a tool that is not installed fails with a message to run npm install instead of being downloaded by npx