0
$\begingroup$

I'm making a very basic physics engine for fun with no roration, just movement, and ran into a problem.

Every object in my simulation has a position vector, a velocity vector and an acceleration vector, and the movement is calculated by first adding the acceleration to the velocity and then adding the velocity to the position.

I'm calculating the force exerted in a collision with force = mass * acceleration, and the acceleration of the object it's colliding with as acceleration = mass / force. The problem I'm having is that if there's no acceleration, aka a constant velocity, my 'physics engine' detects no force and kinda just dies. I'm not a physics student nor do I have any extended knowledge of how these things work, so I'd really appreciate if someone could tell me what I'm doing wrong :)

$\endgroup$
1
$\begingroup$

You've written Newton's second law that $F=ma$. Thus, if acceleration $a=0$, the law tells you that there is no force. However, collision is an interesting phenomenon, in this regard. In case of collision, you do have a force imparted by the bodies on each other, for a very small instance of time. This force is called 'impulse'

In order to solve this, I'd advise you to look at the other form of newton's second law,

$F=dp/dt$ , where $p=mv$ is the momentum.

Thus we have Force is the rate of change of momentum. In a collision, you do have a change in momentum. For example, imagine throwing a ball at the wall. Yes, it's true that the velocity of the ball before and after the collision is the same, but that doesn't imply acceleration is 0. Notice the direction of the velocity. In the first case, it is towards the wall. In the second case, it is away from it. Thus there is a change of velocity, and so, the force had been exerted.

Thus, in your problem, I'd advise you to take a closer look at momentum. Remember, in a collision, the force is exerted for a very short time, the moment the bodies collide. The acceleration might be 0 before the collision, but that doesn't matter to us. In that small instance of collision, the velocity of the bodies change, or their direction changes. This causes a split second of acceleration, and there is your impulse force.

$\endgroup$
2
  • $\begingroup$ Wow, thank you so much! $\endgroup$
    – Coenicorn
    May 27 '21 at 10:24
  • $\begingroup$ @Coenicorn welcome friend. If this helps you solve your problem, I'd ask you to accept this answer by selecting the tick mark on the side. Else, this would remain an open question. $\endgroup$ May 27 '21 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.