• 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.

[JASS] Need help with angles

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
Hey everyone, i was playing Pudge wars..
and i saw that when you hit a wall for example with the hook,
it caculates diffrences in angles, and shoots it towards the next angle.

for example:

a hook is sent toward a wall, the wall is flat, (180 degrees ______),
the hook hits the wall, and the hook does this:

set angle = angle + 180, (makes him turn back) + ~70.
that makes it add a bit wide angle, and allso turn back.
but thats only flat.. how do i caculate every diffrence in the wall?
(if the wall is 100 degrees, 171 degrees, 50 degrees, just in a easy way)
and in Vjass/Jass if you could.

thanks in advance. (this is just out of curiosity.)
 
Level 10
Joined
Jun 26, 2005
Messages
236
Okay, just use this formula I derived:

JASS:
  function GetAngleOfReflection takes real incidence, real tangent returns real
    return 2*tangent+180-incidence
  endfunction
What you do is make sure the wall is a unit, not a doodad, and then

JASS:
call GetAngleOfReflection(GetUnitFacing(projectile), GetUnitFacing(wall))
EDIT: Made it degrees, not radians.
 
Last edited:
Status
Not open for further replies.
Top