1

Im trying to create a collision simulation, for that im trying to understand the Impulse-based reaction mode item in the Collision Response article in Wikipedia, I know reading Wikipedia is not the best way to learn, but im trying to get the simple.

I would like if someone explained me what is the $e$ and the $\hat n$ quoted in the article.

1 Answers1

0

Any impulse-based collision algorithm requires some quantities to describe the collision conditions.

Each collision occurs at a point in space, and often the impulse exchanged is along a predetermined axis. Anytime a surface is in contact with a point, then this direction is the surface normal. Even if two curved surfaces are in contact, there exists a direction that is perpendicular to both surfaces at the point of contact.

This is called the contact normal, and it is designated by the vector $\boldsymbol{n}$ usually.

The law of contact described the relative speed of the objects after the contact $u_{\rm bounce}$ as a function of the relative speed before the contact $u_{\rm impact}$. This law states

$$ u_{\rm bounce} = - \epsilon \; u_{\rm impact} $$

The $\epsilon$ here is a scalar value between 0 and 1, and it is called the coefficient of restitution.

It describes how bouncy the contact is. A value of 0, means the objects will stick together, and with a value 1, they will bounce apart (at maximum speed without violating the conservation of energy).

We use the contact normal to find the impact speed

$$ u_{\rm impact} = \boldsymbol{n} \cdot ( \boldsymbol{v}_1^\text{contact} - \boldsymbol{v}_2^\text{contact})$$

where $\boldsymbol{v}_i^\text{contact}$ is the velocity of body i at the contact point, and $\cdot$ is the vector dot product.

In a computer environment you would do $\boldsymbol{a} \cdot \boldsymbol{b} = \boldsymbol{a}^\top \boldsymbol{b}$, where ${}^\top$ is the transpose operation.

References:

John Alexiou
  • 38,341
  • 2
    So $n$ is the normal of the surface in contact with a vertice? – user354923 Jan 07 '23 at 20:37
  • @user354923 - yes. – John Alexiou Jan 07 '23 at 21:05
  • 1
    One more thing, how would I deal with $n$ if I want to use the formulas for each dimension separately(X then Y)? – user354923 Jan 07 '23 at 21:48
  • @user354923 - It has two components $\boldsymbol{n} = \pmatrix{n_x & n_y}$. You need to work out the equations in vector form, and then project them to 2D using components. So like the dot product would be $\boldsymbol{a} \cdot \boldsymbol{b} = a_x b_x + a_y b_y$ and so on for the rest of the equations. You need some knowledge of vector algebra and linear algebra to do this in a computer setting. – John Alexiou Jan 08 '23 at 04:26
  • @user354923 - did you see this post of mine that handles collisions in 2D with individual components. It rather involved doing it this way. Going a level up to vectors makes the programming so much easier. Regardless of how you handle the math, you will need to find the effective mass of the parts along the contact normal $m^\star$ (also called the reduced mass sometimes) because the impulse calculation becomes trivial afterward with $$J = (1 + \epsilon) m^\star; u_{\rm impact}$$ – John Alexiou Jan 08 '23 at 04:29
  • Im sorry, I dont want to spend much of your time, but I would thank you a lot if you give me an example using some numbers. – user354923 Jan 08 '23 at 15:48
  • @user354923 - Also a good read for you is this article that describes different ways to handle multiple collisions. – John Alexiou Jan 08 '23 at 17:06
  • @user354923 - did you want a numeric example of a whole contact calculation, or just how to deal with the contact normal? – John Alexiou Jan 08 '23 at 17:17
  • I would like for the whole contact calculation, I mean a collision, hope im not bothering you – user354923 Jan 08 '23 at 17:43
  • please bro, you are the only one answering me, I think if I have an example with numbers I will be able to understand it. – user354923 Jan 08 '23 at 19:08
  • @user354923 - I think it is too complex to do the whole thing in my answer, as I feel like have answered the specific question asked, and now we're creeping more into the weeds. Another problem is that you want to do things by component, which makes things an order of magnitude more complex than just using vectors. You will learn a lot more by trying to implement a vector class and doing mechanics this way, rather than staying at the high school physics level. – John Alexiou Jan 08 '23 at 20:43
  • @user354923 - use the example from the post which matches the Wikipedia article (eq. (2) and (3) are equation (5) in wiki). If you can follow the math, then you can ask a specific implementation question on [SO] with the programming language of your choice. If you are confused about the physics, then ask here another specific question. – John Alexiou Jan 08 '23 at 21:18