I'm coding a physics engine in Javascript. Forces, Gravity, Friction, AABBs are taken care of. Now, the big question: how do I respond to AABB collisions? Right now, when an object collides, it prints "collision!" in the console.
What formulas and/or techniques are the fastest?
this runs in the render loop (object is the object currently getting looped):
//AABB STUFF
EasyPhysics.Objects.forEach(function (object0, index0){
if(object.getAABB(object0)) {
object.position.x-=object.force.x;
object.force.x = 0;
object.position.y-=object.force.y;
object.force.y = 0;
object.position.z-=object.force.z;
object.force.z = 0;
};
});