delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/21/20:29:30

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Projectile Bouncing off walls
Date: 21 Jan 2000 16:59:33 -0800
Organization: InterWorld Communications
Lines: 29
Message-ID: <83iu0m3oqy.fsf@mercury.st.hmc.edu>
References: <3888F4D3 DOT 5EDC8FBC AT geocities DOT com>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 948502884 11476 134.173.45.219 (22 Jan 2000 01:01:24 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 22 Jan 2000 01:01:24 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sahab Yazdani <beyonder69 AT geocities DOT com> writes:

> Hello I have written a simple trajectory calcutation system using
> Velocity, Angle, wind and gravity. Now lets say I want to make the
> projectile bounce off the wall.. How would I go about doing this???
> heres the code that I have right now:

Simplest way is to let the angle of incidence equal the angle of
reflection.  Define a normal N, a line perpendicular to the wall at
the point of impact.  The angle between the projectile and N as it
enters (angle of incidence, Ti) should be equal to the angle as it
leaves (angle of reflection, Tr).  Picture:

                   O    |
                    \   |
                  /--\  |
                 /    \ |
                Ti     \|
         N-------------->
                Tr     /|
                 \    / |
                  \--/  |
                    /   |
                   V    |

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019