.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

winSPMBT: Main Battle Tank- Save $6.00
winSPWW2- Save $6.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

Reply
 
Thread Tools Display Modes
  #1  
Old September 12th, 2003, 11:36 PM
Erax's Avatar

Erax Erax is offline
Captain
 
Join Date: Oct 2002
Location: Brazil
Posts: 827
Thanks: 0
Thanked 0 Times in 0 Posts
Erax is on a distinguished road
Default Re: OT: would anyone happen to know how to calculate bouncing a ball off an angled box?

OK, I can explain this to you for one simple situation and you'll have to work it out for the rest.

Let's say that the ball travels along the X-axis, therefore its trajectory is at 0 degrees (at 90 degrees it would be going 'up' the Y-axis). And let's say further that the wall it's going to bounce off of intercepts the X-axis at some point.

OK, now we are going to measure the wall's angle of inclination starting at the X-axis and ending at the wall's 'upper' segment. This angle is therefore being measured in a counter-clockwise direction. Let's call its value A.

Since the ball's trajectory is at 0 degrees, the angle between it and the lower segment of the wall is also equal to the wall's inclination, A. Now it's going to rebound at an angle to the wall's upper segment that is equal to this inclination, therefore to the X-axis itself it is an angle of 2A.

Some examples : Wall at 45 degrees - ball rebounds at 90 degrees (goes up).

Wall at 30 degrees - ball rebounds at 60 degrees.

Wall at 90 degrees - ball rebounds at 180 degrees (trajectory doubles back on itself).

Wall at 135 degrees - ball rebounds at 270 degrees.

The trick is, A is always between 0 and 180; outside these bounds the wall has 'flipped over' and you still have A between 0 and 180.

That's the best I can do from here. I'm not too good at explaining things without drawing lots of diagrams.
__________________
Have you ever had... the sudden feeling... that God is out to GET YOU?
Well, my girl dumped me and I'm stuck with the raftmates from Hell in the middle of the sea and... what was the question again???
Reply With Quote
  #2  
Old September 13th, 2003, 12:57 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: would anyone happen to know how to calculate bouncing a ball off an angled box?

thanks to the both of you.
Quote:
% 360

modulo
that's for making sure it's still between 0-360, right?

anyone know how to figure out what side it hit when the box is rotated? i've got an idea, but it's clunky, rotating the whole thing, ball and box, back to 0 while keeping there relative positions and then back.

[ September 13, 2003, 00:36: Message edited by: narf poit chez BOOM ]
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 04:31 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2026, Shrapnel Games, Inc. - All Rights Reserved.