Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a picture to demostrate what I need,basecaly I have a bullet with velocity and I want it to bounce with the correct angle after it hits a circle

Solved(look the accepted answer for explain):

Vector.vector.set(bullet.vel);    //->v
Vector.vector2.setDirection(pos, bullet.pos);     //->n normal from center of circle to bullet
float;    //->dot product
Vector.vector.y=-Vector.vector.y;  //->for some reason i had to invert the y

enter image description here

share|improve this question
Do you need direction or velocity? If direction that is elementary school stuff... and you are already doing it in almost any shading model. – wondra Aug 17 '14 at 19:21
@wondra just the direction.Well many years have passed since elementary :) – SteveL Aug 17 '14 at 19:29
Find the slope of the circle at the point of intersection (the derivative). Use that slope/line as the line of reflection for the incoming bullet. – Byte56 Aug 17 '14 at 21:31
Some explain for the downvotes ? – SteveL Aug 18 '14 at 10:11
up vote 1 down vote accepted

The formula for reflecting an incoming vector v across a unit normal n into an outgoing vector v' is

v' = v - 2*dot(v,n)*n

You can determine the normal n from normalizing the difference of the collision point and the center of the circle.

See the question on How to get a reflection vector? over on Math.SX for more elaborate derivations.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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