Solve Oblique Collisions in 2D OpenGL Physics Simulation

  • Context: Undergrad 
  • Thread starter Thread starter Tiddlypeeps
  • Start date Start date
  • Tags Tags
    Collisions
Click For Summary

Discussion Overview

The discussion revolves around solving the problem of oblique collisions between balls in a 2D OpenGL physics simulation. Participants explore the application of conservation laws to determine the new velocities of colliding balls, addressing both theoretical and practical aspects of collision detection and response.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant seeks assistance in calculating the new velocities of two colliding balls after detecting a collision.
  • Another participant suggests using conservation of momentum and conservation of energy to derive the post-collision velocities, providing the relevant equations.
  • A participant expresses uncertainty about how to solve for the unknown velocities (V1 and V2) given the equations, noting that there are more unknowns than equations.
  • It is pointed out that there are actually four unknowns (V1x, V1y, V2x, V2y) and only three equations available, implying that additional information is needed to solve the problem.
  • One participant proposes defining a vector between the centers of the balls at the time of contact, suggesting that this could provide an additional equation to help solve for the unknowns.
  • Another participant mentions that if the masses of the balls are equal, the equations simplify significantly, indicating that the velocity components along the line of collision are exchanged while those perpendicular remain unchanged.
  • A further comment states that the force and acceleration during the collision are normal to the plane of contact, implying that the velocity components parallel to this plane remain unchanged regardless of mass differences.

Areas of Agreement / Disagreement

Participants express differing views on how to approach the problem of solving for the new velocities after a collision. There is no consensus on a single method or solution, and the discussion remains unresolved regarding the best approach to take.

Contextual Notes

Participants note the limitation of having more unknowns than equations, which complicates the resolution of the problem. The discussion also assumes ideal conditions such as frictionless surfaces and elastic collisions without explicitly confirming these assumptions.

Tiddlypeeps
Messages
2
Reaction score
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
I presume you mean the velocities after the collision- use "conservation of momentum" and "conservation of energy".

If one object has mass m_1 and velocity vector &lt;v_{1x}, v_{1y}, v_{1z}&gt; (before the collision) and the other has mass m_2 and velocity vector &lt;v_{2x}, v_{2y}, v_{2z}&gt; (before the collision), then the velocity vectors after the collision, &lt;u_{1x}, u_{1y}, u_{1z}&gt; and &lt;u_{2x}, u_{2y}, u_{2z}&gt; must satisfy:

(conservation of momentum) m_1(&lt;v_{1x}, v_{1y}, v_{1z}+ m_2&lt;v_{2x}, v_{2y}, v_{2z}&gt;= m_1&lt;u_{1x}, u_{1y}, u_{1z}&gt;+ m_2&lt;u_{2x}, u_{2y}, u_{2z}&gt;
That gives scalar (numerical) equations, m_1v_{1x}+ m_2v_{2x}= m_1u_{1x}+ m_2u_{2x}, m_1v_{1y}+ m_2v_{2y}= m_1u_{1y}+ m_2u_{2y}, and m_1v_{1z}+ m_2v_{2z}= m_1u_{1z}+ m_2u_{2z}.

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

This is not a mathematics question so much as a physics question. I suggest you post in the "general physics" section.
 
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?
 
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:
 
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.
 
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.
 
Since the force and acceleration are normal to that plane, the velocity components parallel to it are unchanged regardless of the masses involved.
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K