Simple Physics Engine

a simple hand-crafted physics engine written in javascript for FRL's XR interface

Motivated by self-interest, I have written the basic structure of a simple physics engine for our lab’s webXR platform. The physics engine is still unfinished, and I have only written the basic structure, the sphere to sphere collision and sphere to blocks collision. But writing a physics library from scratch is not an easy task. At first I thought a sphere to sphere collision level of algorithm would be easy, but sometimes it can be tricky when dealing with velocity change and multi-bodies collision. Javascript isn’t an OOP language and I have to use an array of a fixed-size to store physical variables, and for the spheres, I sort them by height to deal with multi-bodies collision reaction.

The box collision was added later by one of my talented collegues.