SortaBomber - Explosion Physics
Blow up stuff.
This is my replica of Roblox's "welds" system. This groups static objects together, e.g buildings, but when hit above a set speed, the building will break.
- (RIGHT) click and drag to look around.
- (LEFT) click to fire explosives.
I modified Physijs to work with the WASM version of Ammo, which has improved performance by.. a lot. It's now possible to simulate a few hundred blocks now without any lag. I would update the car physics game with this, but there are a few underlying problems with Physijs itself and Ammo (I spent a few hours getting collisions to work correctly), which means more bug fixing :/
Objects are first added to a parent object. This makes them a compound shape. Explosions are calculated by their position and force. The overall group has a set "strength", and this is reduced by repeated explosions, amplifying the damage done. The velocity of an object is reduced by the distance it is from the explosion, and increased by the explosion force. Objects farther away from the bomb move slower, and vice versa. Because objects cannot move independently from their parent, the ones nearest to the explosion are
orphaned and made dynamic. Simply removing the object from the parent and adding it to the scene doesn't work, so I clone the object (probably a bad idea) instead.
This Repl uses experimental technology that may not yet be supported across all platforms and browsers. For the best experience, use the following:
- A home desktop/laptop computer, some schools may block some files
- Chrome 89 or as recent as possible
What may be the issue:
- Module Web Workers
- ES6 (Don't use Internet Explorer 😭)