Solve Oblique Collisions in 2D OpenGL Physics Simulation

  • Thread starter Tiddlypeeps
  • Start date
  • Tags
    Collisions
In summary, In your physics simulation, if the masses of the balls are all the same, you need to solve for V1 and V2 using 4 equations. If the masses are not all the same, then the collision will result in a reflection of the velocity in a plane perpendicular to the line between the balls.
  • #1
Tiddlypeeps
2
0
Hi, I am in the process of doing up a physics simulation in 2D OpenGL where balls bounce around the place, colliding with planes and themselves.

I have everything done except the collisions between the balls themselves. I can detect a collision but I am finding it hard to find any sort of documentation on how to find the new velocities of both balls.

Can anyone help me out?

I hope this is posted in the right forum >_<
 
Physics news on Phys.org
  • #2
I presume you mean the velocities after the collision- use "conservation of momentum" and "conservation of energy".

If one object has mass [itex]m_1[/itex] and velocity vector [itex]<v_{1x}, v_{1y}, v_{1z}>[/itex] (before the collision) and the other has mass [itex]m_2[/itex] and velocity vector [itex]<v_{2x}, v_{2y}, v_{2z}>[/itex] (before the collision), then the velocity vectors after the collision, [itex]<u_{1x}, u_{1y}, u_{1z}>[/itex] and [itex]<u_{2x}, u_{2y}, u_{2z}>[/itex] must satisfy:

(conservation of momentum) [itex]m_1(<v_{1x}, v_{1y}, v_{1z}+ m_2<v_{2x}, v_{2y}, v_{2z}>[/itex][itex]= m_1<u_{1x}, u_{1y}, u_{1z}>+ m_2<u_{2x}, u_{2y}, u_{2z}>[/itex]
That gives scalar (numerical) equations, [itex]m_1v_{1x}+ m_2v_{2x}= m_1u_{1x}+ m_2u_{2x}[/itex], [itex]m_1v_{1y}+ m_2v_{2y}= m_1u_{1y}+ m_2u_{2y}[/itex], and [itex]m_1v_{1z}+ m_2v_{2z}= m_1u_{1z}+ m_2u_{2z}[/itex].

(conservation of energy) [itex]m_1(v_{1x}^2+ v_{1y}^2+ v_{1z}^2)+ m_2(v_{2x}^2+ v_{2y}^2+ v_{2z}^2)[/itex][itex]= m_1(u_{1x}^2+ u_{1y}^2+ u_{1z}^2)+ m_2(u_{2x}^2+ u_{2y}^2+ u_{2z}^2)[/itex].

This is not a mathematics question so much as a physics question. I suggest you post in the "general physics" section.
 
  • #3
I have seen this equation a few times before, I am not entirely sure how to use it to deciper V1 and V2.

I have the variables M1, M2, U1 and U2, but that still leaves 2 unknows in the equation, V1 and V2. How do I solve these?
 
  • #4
Moderator's note: I have moved the thread to "General Physics".
Tiddlypeeps said:
I have seen this equation a few times before, I am not entirely sure how to use it to deciper V1 and V2.

I have the variables M1, M2, U1 and U2, but that still leaves 2 unknows in the equation, V1 and V2. How do I solve these?
Hmm, it's actually 4 unknowns, V1x, V1y, V2x and V2y. But only 3 equations,
  • Conservation of x-component of momentum
  • Conservation of y-component of momentum
  • Conservation of kinetic energy
It would seem one more equation or piece of information is required to solve the problem. I'll have to think about this some more, or maybe somebody else can chime in.

p.s. welcome to Physics Forums :smile:
 
  • #5
Okay, I have thought about this some more.

Since you can detect a collision, I take it you can locate the positions of the balls' centers at the time of contact? If yes, then define a vector from one ball's center to the other ball's center. The velocity components perpendicular to this direction will be unchanged by the collision. That adds a 4th equation (in addition to momentum x & y, and kinetic energy conservation) to solve for the 4 unknowns I listed in my previous post.

Here I am assuming smooth (frictionless) surfaces. Hope that helps ... you'll need to work out the math from my description.
 
  • #6
In your simulation, are all the masses the same? If so, the equations simplify tremendously.

The balls reflect off the plane that is perpendicular to the line between them. The components of the velocity that is in the plane will be unchanged (there is no force in this direction), and the components along the line are exchanged.

Double check me, but I think that is the answer for an elastic collision when the masses are equal.
 
  • #7
Since the force and acceleration are normal to that plane, the velocity components parallel to it are unchanged regardless of the masses involved.
 

1. What is an oblique collision in a 2D OpenGL physics simulation?

An oblique collision refers to a scenario in which two objects collide at an angle, rather than head-on. This can happen in 2D simulations, where objects have both horizontal and vertical velocity components.

2. How do you solve oblique collisions in a 2D OpenGL physics simulation?

To solve oblique collisions, you can use the conservation of momentum and conservation of energy principles. This involves calculating the initial and final velocities of both objects, as well as the direction and magnitude of the resulting forces.

3. What factors affect the outcome of an oblique collision in a 2D OpenGL physics simulation?

The outcome of an oblique collision can be affected by various factors, including the masses and velocities of the objects, the angle of collision, and the coefficient of restitution (a measure of how much energy is lost in the collision).

4. How accurate are oblique collision simulations in 2D OpenGL?

The accuracy of oblique collision simulations in 2D OpenGL depends on the complexity of the simulation and the precision of the calculations used. In general, the more realistic the simulation, the more accurate the results will be.

5. Can oblique collisions be used to simulate real-life scenarios?

Yes, oblique collisions can be used to simulate real-life scenarios in which objects collide at an angle, such as billiard balls hitting each other or cars colliding on a diagonal path. However, the accuracy of the simulation will depend on how well the real-life scenario is represented in the simulation.

Similar threads

Replies
14
Views
1K
  • Mechanics
Replies
9
Views
1K
  • Mechanics
Replies
10
Views
2K
Replies
8
Views
3K
Replies
3
Views
1K
  • Mechanics
Replies
1
Views
1K
Replies
1
Views
784
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
2
Views
1K
Replies
14
Views
2K
Back
Top