• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] Angle Finding

Status
Not open for further replies.
Is this formula how to find the bouncing angle?
[jass=] private function NormalizeAngle takes real angle returns real
local integer a

if (0 > angle) then
set a = R2I(angle*180/bj_PI - 45)/90*90
else
set a = R2I(angle*180/bj_PI + 45)/90*90
endif

if (0 > a or 360 < a) then
set a = a - a/360*360

if (0 > a) then
set a = a + 360
endif
endif

return a/180.*bj_PI[/code]

It is Nest's Code from is path blocked
 
Level 12
Joined
Oct 16, 2010
Messages
680
well for bouncing , there's two option

1) bounce off Y-axis
2) bounce off X-axis

and this single function is not enough to determine this

EDIT : ok so what this function does
converts the angle to a single amount which is capable for determining the new angle with cos() or sin() (i think:D)
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
zeichnung1065.jpg

http://peeeq.de/draw.php?id=1065

surface --> 315

mirror (normal) to surface --> 135+90=225

inAngle = 90

difference between mirror and inAngle --> 225-90=135

135*2=270

add it to inAngle --> 90 + 270 = 360

revert it --> 360 + 180 = 540 --> 180
 
Status
Not open for further replies.
Top