Hello. For a while now I've been doing some tests with some theories or physics laws, and I wanted to make manual collisions, without physics behavior, since it's way too complicated for something this simple - I don't need friction, rotation or collision polygons just to name a few.

I've tried a bunch of formulas, both that I have tried to come up with and some I've made with a little advice from some people online. So far none have worked.

I came across this, which someone said would be able to explain how to find the velocity of an object after collision with another, but all I can see is:

And that involves the end result of the second particle, which means I can't use it for actually calculating one of the answers in the first place.

That is just for the X velocities, and you can do the same for Y.

Depending upon how the objects collide(which side) you'd adjust either the X velocities or the Y velocities. So you'd need a way to determine which side is colliding.

One way is to determine how far the object overlaps each other in the x and y axis, and depending upon which depth is shorter, use that axis.

The RIGHT side of obj1, should check with the LEFT side of obj2. abs(obj1.boundingboxright-obj2.boundingboxleft).

The LEFT side of obj1 should check with the Right side of obj2. abs(obj1.boundinboxleft-obj2.boundingboxright).

Similarly for the Top, and Bottom..

Then check which value is smallest, to determine which velocities to adjust.

For circular collisions, you'll need to find the normal of the surface where the collision occurs and the vector perpendicular to it. Then you have to project the velocities onto those vectors and apply the momentum stuff to the projected vectors I think..

So with some algebra I was able to calculate it as:

v1f = (v1i*(m1-m2) + 2*v2i*m2)/(m1+m2)

v2f = (-v2i*(m1-m2) + 2*v1i*m1)/(m1+m2)

Now those velocities are in only one dimension. For 2d collisions if we only need to consider the speeds along the normal between the two objects, which is still is one dimensional.

So the steps would be:

1. calculate the normal between the two objects.

--- normalx=cos(angle from object1 to object2)

--- normaly=sin(angle from object1 to object2)

2. calculate v1i and v2i only in direction of the normal.

You can also incorporate a coefficient of restitution into the impulse equation so you can anything from a "perfectly elastic collision" to an "inelastic collision".