//A physics circle public class Ball{ public Vector2D Pos; public Vector2D Vel; public Vector2D Force; //primarily a buffer for force being applied this frame public float max_vel; public float min_vel; public float r; public float Mass; public float Elasticity; public boolean killMe; public boolean launched; public int liftOff; Ball() { Pos = new Vector2D(); Vel = new Vector2D(); Force = new Vector2D(); max_vel = 150.0f; min_vel = 50.0f; r = .5f; Mass = 1.0f; Elasticity = 1.0f; killMe = false; launched = false; liftOff = 0; } public void AddForce(Vector2D force) { Vel.limitMax(max_vel); Force.PlusEquals(force); } public void SubForce(Vector2D force) { Force.MinusEquals(force); } public void LimitMaxVel() { float maxVel = max_vel; Vel.limitMax(maxVel); } public void LimitMinVel() { float minVel = min_vel; Vel.limitMin(minVel); } public void CollideWithLineSeg(LineSeg2D ls) { //Insert a collision response function here // System.out.println("BOING!\n"); Vel.Set((Vector2D.Reflect(Vel.Negative(),ls.UnitNorm())).Times(Elasticity)); } public void CollideWithPaddle(Paddle p) { } }