# Re: [Audyssey] programming question

```Hi Ken
```
To answer your question, off the top of my head, when two sferes collide, the angle of boath sfere's movement should be taken into account. This asumes full on collision. Glancing collisions can get complecated, I think. With that I mean that they don't scrape past each other or something. The method for 2 vs 3d movement is basically the same, but the vectors have more components in 3d. To calculate the resulting movement you'll need to split the movement vector into components with sin and cos and then apply the components to the other sfere.

```
A simple  2d example:
a ball, heading 0, speed 1 hits a puck     heading 45, speed 2.
the balls x component =1 and y component =0 (sin(180 =0) and cos(0) =1)
the puck's x and y components =2*0.707
=1.414
(speed * sin or cos of the angle)
to calculate the effect on the ball:
```
new x component =1+1.414 =2.414. The y component will be 1.414. You can get the new angle with arc tangent and also get the new velocity with pythagoras.
```
hth. And feel free to correct any errors  I made.

On 2/3/2011 8:37 AM, Ken the Crazy wrote:
```
```Two questions, possibly related.  First, how do I access mouse support for BGT?  You also
mentioned monsters that can follow paths.  (Thanks, by the way for the tutorial.  I've
been looking it over, and even if I don't use BGT it'll help me understand all the
"new" stuff introduced by vb.net.)  Yeah yeah, it's what?  Six years old now?
Oh well...

Second, (and I'm not sure what language I'm going to be programming this in,) I was
looking at Air Hockey and I thought, "Shuffleboard--that would be cool!"
So I need an equation to find out how one circle impacts another upon
collision.  Collision detection itself isn't a problem for me--you basically
just subtract the distance from the center of one circle to that of another,
and if it equals the circles' radii, they collided.  But there's that little
matter of what happens next--does the putt go straight, diagonally, right or
left, and how far?
Ken
---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
```
```

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,