• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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