• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Can someone explain this Polar Offset to me please?

Status
Not open for further replies.
Level 8
Joined
Aug 1, 2008
Messages
420
Ive used this so much, but, i can never get it perfect. I have to try at least 20 times to get it near perfect, then just give up and leave it with what i have it close to. Can someone explain to me, what determines the range, angle, and angle they face please? Like break the trigger down. ;)
 
Level 8
Joined
Nov 9, 2008
Messages
502
JASS:
function PolarProjectionBJ takes location source, real dist, real angle returns location
    local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
    return Location(x, y)
endfunction

That's what is happening if you use PolarProjection in GUI. Uses coordinates and sin/cos to calculate the new coordinates.

JASS:
constant real      bj_DEGTORAD                      = bj_PI/180.0
constant real      bj_PI                            = 3.14159

Radian (RAD) = "An angle of 1 radian results in an arc with an equal length to the radius of the circle." - Wiki

EDIT: I think 1 thing to take into consideration is that 0-360 actualy starts at east. So east = 0 degrees

Range = Determined by the distance you enter into the trigger

Angle = What you enter will be East(0)+YourAngle going clockwise. So an angle of 90 degrees will produce an offset in a southern direction

Facing Angle = There is no specification for this in the function. You have to use another function if you want to change this.

I hope that explains it a little better. Ask if you're still not sure.

My question is: Why does the angle have to be converted to radians??
Iv'e always thoughtthat maths and circles do not mix well :p
 
Last edited:
Level 8
Joined
Nov 9, 2008
Messages
502
Maybe I'm coming from a different perspective then. Logically North would be 0 and run through to 360 in a clockwise direction.
 
Level 8
Joined
Aug 1, 2008
Messages
420
So, how exactly would you get something(anything) appear behind a unit, where ever its facing?

I always have to mess around to do something like this.

oh and then, how will you edit the distance to how close behind it is to the unit?
 
Status
Not open for further replies.
Top