# Can someone explain this Polar Offset to me please?

Status
Not open for further replies.

#### FriXionX

Level 8
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.

#### toofless

Level 8
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

Last edited:

#### eleljrk

Level 9
90 = north
180 = west
0 / 360 = east
270 = south

- / + 45 is between all those (South east: 315)

Hope that helps!

#### toofless

Level 8
Oh ok my bad.
0-360 goes counter-clockwise :/

#### eleljrk

Level 9
Oh ok my bad.
0-360 goes counter-clockwise :/

Ehhmm. No? :s Its "POLAR" offset, like a Compass.

#### toofless

Level 8
Maybe I'm coming from a different perspective then. Logically North would be 0 and run through to 360 in a clockwise direction.

#### eleljrk

Level 9
Maybe I'm coming from a different perspective then. Logically North would be 0 and run through to 360 in a clockwise direction.

90 is north. lol...
If you continiue talk, act and do stuff without READING tutorials, or even answers on your own thread, you wont come any place in this advanced world. Continiue read, and you will sucesse.

#### FriXionX

Level 8
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?

#### Reaper2008

Level 12
A) Polar offset with angle = Facing of target + 180.
B) Distance .

Status
Not open for further replies.

Replies
3
Views
2K
Replies
6
Views
1K
Replies
7
Views
2K
Replies
9
Views
636
Replies
10
Views
847