Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
bouncing ballz   Message List  
Reply | Forward Message #9731 of 15019 |
Re: [gbadev] bouncing ballz

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/
>
>
>





Fri Feb 1, 2002 5:20 pm

mike.wynn@...
Send Email Send Email

Forward
Message #9731 of 15019 |
Expand Messages Author Sort by Date

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...
Ben Hopkins
gbtheoryuk
Offline Send Email
Feb 1, 2002
4:39 pm

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...
Mike Wynn
mike.wynn@...
Send Email
Feb 1, 2002
5:55 pm

... V = velocity vector N = normal of the line (unit vector) R = response vector R= -2*(V dot N)*N that's it wim yedema...
Wim Yedema
tharsis_bliss
Offline Send Email
Feb 4, 2002
9:31 am

How can that work ? V dot N is a scalar, all you return is a vector that lies on the normal to the line with a length related to the cos of the angle betwen N...
Mike Wynn
mike.wynn@...
Send Email
Feb 4, 2002
6:04 pm

... sorry you're right it's R=V-2*(N dot V)*N if you want it to bounce lower multiply by a value between -1 and -2...
Wim Yedema
tharsis_bliss
Offline Send Email
Feb 5, 2002
9:37 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help