# Accurate Bouncing Off An Angled Surface

• 01-21-2006, 09:21 PM
-SA-
Accurate Bouncing Off An Angled Surface
Hey, i post here in hope someone can answer my question :)

How would i make a ball bounce off an angled surface? I have it bouncing off a horizontal and vertical and i have the accurate bounce sorted (Gravity, friction), but i'm stumped when it comes to angled surfaces.

I have a feeling it is to do with reflection, Ri (reflected) is R + (2N * - N . R);
Where N is the normal. However, even if it is achieved by this method, i am stuck on how to use it.

Just for clarity:
http://img12.imageshack.us/img12/7509/example0xv.png

Any help would be greatly appreciated : D
• 01-23-2006, 04:00 AM
Pugger
Try here: http://www.tonypa.pri.ee/vectors/start.html

Its about vectors and has a section on making a ball bounce off any surface.
• 01-23-2006, 09:38 PM
rafucho
Hi, SA:
I have it already worked out for given values of the angle of inclination of the surface and the angle at which the ball is moving AND for the case in which the motion takes place on a horizonta surface, i.e., without gravity entering into the picture. If you give me some time I believe I can, first, having it work for any angles (that involves no problem) and for motion on a vertical plane, i.e., with gravity.
• 01-28-2006, 05:58 PM
ozmic66
hey
i tried this a while ago using angles and such:

it did get a little complicated though, and since then i've discovered a much easier way to do this:

^^^^^^
<<<<VECTORS>>>>
!!!!!!!!!!!!

(can u sense the enthusiasm?)

otherwise, read about what vectors are, and some of their operations (normalizing, dot-product, etc...) and then read on (it's really pretty simple)

so here's my explanation:
-------------------------------------------

first we'll define pointA and pointB as the points between which the surface is stretched out

surfaceVector will represent the surface, by beginning at 'pointA' and stretching out to 'pointB'

we'll then have a velocity vector which starts at the position of the object's old position, and ends at the point of intersection on the surface

(when i say starts and ends i only mean it theoretically, as vectors have no position in space, but i use it for visualization)

so the two vectors we have are all that we really need!
as you know, in order to 'bounce' the velocity vector, we have to flip it horizontally around the surface
to do that, we'll do the following thing:

1. find the projection of the velocity vector on the surface vector (there-by getting the x-component)

2. once you have that scalar number, you create a vector in the direction of the surface, normalize it, and multiply it by the scalar #

3. you then add that vector to the velocity vector in order to make it 'bounce'

4. you are done --> watch your creation and enjoy

to add friction you can multiply that scalar by a coefficient (between 0 and 1)

If you are wondering how to 'project one vector onto another', try this:
for our example:
vectorA will be the projector (the one being projected)
vectorB will be the projectee (the one being projected upon)

1. normalize the projectee (VectorB)
2. find the dot product of VectorA and VectorB (call the result projectionScalar)
here's a picture:
http://design.fileitup.com/fisix/projection.jpg
---> that's all for projection, but you want to turn that scalar into a vector:
3. create a copy of surfaceVector (call it projectionVector)
4. normalize projectionVector
5. multiply projectionVector by projectionScalar
6. and there you have it, just add it to your velocity and you are done

i know that what i wrote might not be exactly 'clear', so dont be ashamed to drop me a line