I am trying to write a simple Physics simulator. However I am facing issues with how the ball bounces. Even though my RESTITUTION is set to 1, the ball bounces a little extra every time it touches the ground.
The Restitution variable:
public static double RESTITUTION=1d;
The code for handling bounce:
if(Y<c.getRadius()){
VY=Math.abs(VY)*Utils.RESTITUTION;
Y=c.getRadius();
c.getCenter().setY(Y);
c.getV().setY(VY);
}
All variables use double as data type. Y is the center of the ball. VY is Y-component of velocity.