Saturday, April 28, 2018

java - Change in force on objects after collision


i am implementing a billiard simulation game and i have a question about collision response.


As integrator, i am using Semi-Implicit Euler,


ball.setVelocity(ball.getVelocity().add(ball.getAcceleration().multiply(dt)));
ball.setPosition(ball.getPosition().add(ball.getVelocity().multiply(dt)));

Before integrating, i am calculating acceleration :


this.setAcceleration(this.getForce().multiply(1 / this.getMass()));

dt is time frame here, and acceleration, velocity, force and position are Vector class. (operations as add, multiply... are standard vector operations).



My question is - when i initially hit ball with cue, i am giving force -k*x (Hooke's law) to ball. But when it collides with other ball, i can only find formulas that calculate new position and new velocity, but my force will stay same. But how to change force here in both balls (it will change velocity and position later in SE Euler).


I appreciate any answer!




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...