from what I remeber of A level maths,
the dot product of your motion vector and the normal to the line will give
you the angle
between the normal and the motion vector
I can't find my math text book, but its something like
a.b = |a||b|cos(angle) = ax.by - ay.bx
|a| is the lenght of the vector (its modulus) => ax*ax + ay*ay
the vector can then need to be rotated as required remember that the angle
is the angle between the vectors as if the both started at the origin and
measures anticlockwise from a to b (from what I can remeber of vector
maths).
you can of course use the line/motion angle and add/subtract 90 from it.
to get the require rotation.
I'm sure that are are several short cuts, but you now have a basis to start
looking from.
Mike.
----- Original Message -----
From: "Ben Hopkins" <gbtheory@...>
To: <gbadev@yahoogroups.com>
Sent: Friday, February 01, 2002 4:26 PM
Subject: [gbadev] bouncing ballz
> The project Im currently working on requires me to have bouncing ball. I
> know some basic vector math but haven't been able to find how to do what I
> want. Cue -=bad=- ASCII diagram :o)
> OK I have a multisided 2d poly and I want to make a ball bounce
> realistically around the inside of the poly:
>
> ________________
> / \
> / \
> / \
> / O \
> \ /
> \_________________/
>
> So what I need to know is how to calulate the new vector once the ball
> collides with one of the lines. Im guessing it'll have something to do
with
> the normal of each line??
> Thanx in advance :o)
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>