I am currently at a stage in developing a game (a more advanced pong) where I want to start making the objects in the game behave more like real world objects.
I want to put some free moving obstacles in the game that the ball can collide with. I wanted to have this "equation" for just the plain ball/wall/paddle collision, but I ended up using the x,y velocity trick where you invert the x,y velocity depending on which object the ball collided with.
What I am looking for, and I just havnt managed to find the right explation/equation, is two things.
A.) When a collision happens, finding the angle of which the ball should bounce away from the object collided with. (The reason I need a more advanced approach is that the free moving objects can obviously be rotated to any degree and not just the vertical/horizontal position).
B.) Working out how much force needs to be transfered into angular momentum/torque.
I am going to start with a rectangular object, and a round or square ball. It seems to me that, logically, the further the ball hits to the edge (lengthwise) of the rectangle, the more force will be transfered to torque, rather than normal x/y velocity. Althought im sure this will also be modified by the angle of which the ball has collided with the rectangular object.
I suppose to make it simple, I need "two?" equations.
One for finding the angle(or x,y velocity) that the ball will travel after colliding with a free moving object.
The other for determining the amount of force transfered to each objects torque.
I can imagine that this could get quite complex with different shape objects, I just want to get my foot in the door with some clear equations to get some practice with.