I am working on a real time stratagy game.(trying)
Right now im working on just simply moveing units.
I was thinking just to get units to look ware i want them to, i woud do somthin like this.
Y2=LookAtY-Y
X2=LookAtX-X
LookAngle=ATan2(Y2,X2)
or in other words
local rotator rot;
local float y1;
local float y2;
local float x1;
local float x2;
local float dy;
local float dx;
local float phy;
y1=Location.Y;
x1=Location.X;
dy=y2-y1;
dx=x2-x1;
phy = ATan2(dy,dx);
rot.yaw = phy;
SetRotation(rot);
it errors:
wen i do atan with out the 2 it dose work. i know atan2 is amore acurat ver of atan dose it matter?
(im only 13 i dont realy know wat eather wer 3 hrs ago)
so basicly
1. how do i get atan2 to work
2. and or can i just use ATan
Right now im working on just simply moveing units.
I was thinking just to get units to look ware i want them to, i woud do somthin like this.
Y2=LookAtY-Y
X2=LookAtX-X
LookAngle=ATan2(Y2,X2)
or in other words
local rotator rot;
local float y1;
local float y2;
local float x1;
local float x2;
local float dy;
local float dx;
local float phy;
y1=Location.Y;
x1=Location.X;
dy=y2-y1;
dx=x2-x1;
phy = ATan2(dy,dx);
rot.yaw = phy;
SetRotation(rot);
it errors:
wen i do atan with out the 2 it dose work. i know atan2 is amore acurat ver of atan dose it matter?
(im only 13 i dont realy know wat eather wer 3 hrs ago)
so basicly
1. how do i get atan2 to work
2. and or can i just use ATan
Comment