*** Now twice the speed, twice the FUN *** Green flag to start, Click or Touch to shoot See also: Pool Shark [Remake] | Retro Arcade https://scratch.mit.edu/projects/485302235/ Whilst you're here why not check out: Science: https://scratch.mit.edu/studios/26831275/ Games: https://scratch.mit.edu/studios/27050111/ #games #pool #collision
Based on Pool Shark (1977) Atari See also 2d Elastic Collisions https://scratch.mit.edu/projects/408908015/ Friction is added to the elastic collisions. dx = dx - (C*dx) dy = dy - (C*dy) Where C is the coefficient of friction a constant between 0-1. Physics of elastic collisions in one dimension An elastic collision is a collision in which kinetic energy is conserved. That means no energy is lost as heat or sound during the collision. In the real world, there are no perfectly elastic collisions on an everyday scale of size. But you can get the sense of an elastic collision by imagining a perfect pool ball which doesn't waste any energy when it collides. In an elastic collision, both kinetic energy and momentum are conserved (the total before and after the collision remains the same). Momentum is the product of mass and velocity: p=mv Conservation of momentum: m₁u₁+m₂u₂=m₁v₁+m₂v₂ if m₁=m₂ then v₁=u₂, v₂=u₁ Elastic collisions in two dimensions We will follow a 7-step process to find the new velocities of two objects after a collision. The basic goal of the process is to project the velocity vectors of the two objects onto the vectors which are normal (perpendicular) and tangent to the surface of the collision. This gives us a normal component and a tangential component for each velocity. The tangential components of the velocities are not changed by the collision because there is no force along the line tangent to the collision surface. The normal components of the velocities undergo a one-dimensional collision, which can be computed using the one-dimensional collision formulas presented above. Next the unit normal vector is multiplied by the scalar (plain number, not a vector) normal velocity after the collision to get a vector which has a direction normal to the collision surface and a magnitude which is the normal component of the velocity after the collision. The same is done with the unit tangent vector and the tangential velocity component. Finally the new velocity vectors are found by adding the normal velocity and tangential velocity vectors for each object. 1) Find unit normal and unit tangent vectors. 2) Create the initial (before the collision) velocity vectors, v1 and v2. 3) Resolve the velocity vectors, v1 and v2 into normal and tangential components. To do this, project the velocity vectors onto the unit normal and unit tangent vectors by computing the dot product. Let v1n be the scalar velocity of object 1 in the normal direction. Let v1t be the scalar velocity of object 1 in the tangential direction. Similarly, let v2n and v2t be for object 2. These values are found by projecting the velocity vectors onto the unit normal and unit tangent vectors, which is done by taking the dot product. 4) The tangential components of the velocity do not change after the collision because there is no force between the circles in the tangential direction during the collision. 5) Find the new normal velocities. This is where we use the one-dimensional collision formulas. 6) Convert the scalar normal and tangential velocities into vectors. Multiply the unit normal vector by the scalar normal velocity and you get a vector which has a direction that is normal to the surfaces at the point of collision and which has a magnitude equal to the normal component of the velocity. It is similar for the tangential component. 7) Find the final velocity vectors by adding the normal and tangential components for each object. Note: initial velocity dx = final velocity dx initial velocity dy = final velocity dy Reference: https://www.vobarian.com/collisions/2dcollisions2.pdf https://en.wikipedia.org/wiki/Elastic_collision