In my code there are two balls with certain velocity both from different direction collide with eachother... After Collision they are supposed to bounce back with certain velocity...But in my code they just stuck together the moment the collide eachother.
I tried to set restitution value 15 for both bodies, but the bodies vanish after collision...
Any help would be highly appreciated.
Thanks in advance>>
protected void init(World world) { world.setGravity(0,0); // Body BallA= new Body("Cart", new Circle(15), 100); Body BallB= new Body("Cart", new Circle(15), 100); BallA.setPosition(150, 375); BallB.setPosition(300, 375); BallA.adjustVelocity(new Vector2f(20f, 0f)); BallB.adjustVelocity(new Vector2f(-20f, 0f)); // ball1.getBody().setRestitution(15); // ball2.getBody().setRestitution(15); world.add(ball1); world.add(ball2); }