# Collision Calculation in 2D

For a 2D physics simulation, I need to resolve collisions between two objects in 2D. I have available each object's initial angular velocity, linear velocity, mass, moment of inertia, and center of mass. For the collision, I have available the point of contact and coefficient of restitution. How do I calculate each object's final angular and linear velocity?

• Hi Jcsq6. Welcome to Phys.SE. If you haven't already done so, please take a minute to read the definition of when to use the homework-and-exercises tag, and the Phys.SE policy for homework-like problems. Commented Nov 1, 2023 at 5:05
• Voting to reopen. This is clearly a conceptual question rather than a homework question. Commented Nov 1, 2023 at 9:50

Do the 3D body collision but only allow motion along the xy plane and rotations about the z axis. In the link therein there is a link to a very important paper about computer simulations of rigid bodies which you can reference for your own benefit.

1. Definitions - Two bodies, each with mass $$m_1$$ and $$m_2$$, mass moment of inertia at each center of mass of $$I_1$$ and $$I_2$$ with CoM position vectors $$\vec{r}_1$$ and $$\vec{r}_2$$, and velocity vectors $$\vec{v}_1$$ and $$\vec{v}_2$$, as well as rotation (scalars) $$\omega_1$$ and $$\omega_2$$.

Contacting bodies definitions for the general 3D case.

2. Contact Properties - The contact happens at a location $$\vec{r}_A$$, and along the perpendicular (normal) direction of $$\hat{n}$$ shown above as acting on body #2 and reacting on body #1.

\begin{aligned} \vec{r}_1 & = \pmatrix{x_1 \\ y_1} & \vec{r}_2 & = \pmatrix{x_2 \\ y_2} & \vec{r}_A & = \pmatrix{x_A \\ y_A} \\ \vec{v}_1 & = \pmatrix{\dot{x}_1 \\ \dot{y}_1} & \vec{v}_2 & = \pmatrix{\dot{x}_2 \\ \dot{y}_2} & \hat{n} & = \pmatrix{n_x \\ n_y} \end{aligned}

3. Impact Speed - Work out the relative velocities of the two bodies at the contact point, and project the velocity along the contact normal to get the impact speed.

$$\begin{gathered}v_{{\rm imp}}=n_{x}\left(\dot{x}_{1}+\omega_{1}(y_{1}-y_{A})-\dot{x}_{2}-\omega_{2}(y_{2}-y_{A})\right)+\\ +n_{y}\left(\dot{y}_{1}+\omega_{1}(x_{A}-x_{1})-\dot{y}_{2}-\omega_{2}(x_{A}-x_{2})\right) \end{gathered} \tag{1}$$

4. Reduced Mass - This is the effective mass the contact feels and it is used to calculate the impulse magnitude to make the objects bounce of each other.

$$m_{{\rm imp}}=\frac{1}{\tfrac{1}{m_{1}}+\tfrac{\left(n_{x}(y_{1}-y_{A})+n_{y}(x_{A}-x_{1})\right)^{2}}{I_{1}}+\tfrac{1}{m_{2}}+\tfrac{\left(n_{x}(y_{2}-y_{A})+n_{y}(x_{A}-x_{2})\right)^{2}}{I_{2}}} \tag{2}$$

5. Impulse Magnitude - Impact calculations are 1D along the contact normal, and this gives us exactly how much momentum is exchanged between the objects

$$J = (1+\epsilon) \, m_{\rm imp} \, v_{\rm imp} \tag{3}$$

The contact is characterized by the coefficient of restitution $$\epsilon$$.

6. Impulse Response - Each object changes its motion parameters instantaneously according to the following expressions

\small \begin{aligned}\Delta\dot{x}_{1} & =-\frac{n_{x}}{m_{1}}\,J & \Delta\dot{x}_{2} & =+\frac{n_{x}}{m_{2}}\,J\\ \Delta\dot{y}_{1} & =-\frac{n_{y}}{m_{1}}\,J & \Delta\dot{y}_{2} & =+\frac{n_{y}}{m_{2}}\,J\\ \Delta\omega_{1} & =-\frac{n_{x}(y_{1}-y_{A})+n_{y}(x_{A}-x_{1})}{I_{1}}\,J & \Delta\omega_{2} & =+\frac{n_{x}(y_{2}-y_{A})+n_{y}(x_{A}-x_{2})}{I_{2}}\,J \end{aligned} \tag{4}

7. Simulation - Continue the simulation after assigning the new motion parameters to the objects

\begin{aligned}\dot{x}_{1} & \leftarrow\dot{x}_{1}+\Delta\dot{x}_{1} & \dot{x}_{2} & \leftarrow\dot{x}_{2}+\Delta\dot{x}_{2}\\ \dot{y}_{1} & \leftarrow\dot{y}_{1}+\Delta\dot{y}_{1} & \dot{y}_{2} & \leftarrow\dot{y}_{2}+\Delta\dot{y}_{2}\\ \omega_{1} & \leftarrow\omega_{1}+\Delta\omega_{1} & \omega_{2} & \leftarrow\omega_{2}+\Delta\omega_{2} \end{aligned}

you can use those equations

$$\def \b {\mathbf}$$

Translation \begin{align*} &\b v_1=-\frac{\lambda}{m_1}\,\b n+\b u_1 \\ &\b v_2=+\frac{\lambda}{m_2}\,\b n+\b u_2 \end{align*}

Rotation \begin{align*} &\b\omega_1=\b\Omega_1-\lambda\,\b q_1\\ &\b\omega_2=\b\Omega_2-\lambda\,\b q_2 \end{align*} Energy equation \begin{align*} [(\b v_2-\b v_1)+\epsilon(\b u_2-\b u_1)]\cdot \b n+ [(\b\omega_2\cdot \b q_2-\b \omega_1\cdot \b q_1)+ \epsilon(\b \Omega_2\cdot \b q_2-\b\Omega_1\cdot\b q_1)]=0 \end{align*}

where \begin{align*} &\b q_1=\frac{1}{I_1}\,(\b r_1\times \b n)_z\\ &\b q_2=\frac{1}{I_2}\,(\b r_2\times \b n)_z\\ \end{align*}

unknowns are the x,y components of the velocities $$~\b v_i~$$ after the collision, the angular velocities $$\omega_i~$$ and $$~\lambda~$$ , altogether 7 unknowns. to solve the problem , you obtained 4 translation equations, 2 rotation equations and the energy equation, altogether 7 equations

Input

• $$~\b u_i~$$ velocities x,y components bevor collision
• $$~\Omega_i~$$ angular velocities bevor collision
• $$~\b n~$$ unit collision normal vector
• $$~\b r_i~$$ vector from the collision point to the center of mass
• $$~I_i~$$ Inertia of the bodies about the z axes
• $$~m_i~$$ Bodies mass
• $$~\epsilon~$$ restoration coefficient $$~0 \le \epsilon\le 1~$$

Output

• $$~v_i~$$ Center of mass velocities after collision
• $$~\omega_i~$$ angular velocities after collision