tortuosit 485 Posted April 29, 2016 Hi guys, I guess this is atan magic. It goes over my head and I searched and couldn't find. - Player looks to a direction on the map. Lets say, to 42.42° - I want to find out the direction where he looks (0-360 degrees numeric value) I just found vector based commands. Like: _verctor = eyeDirection player; So how do I convert the vector to my desired angle? TIA Share this post Link to post Share on other sites
tortuosit 485 Posted April 29, 2016 Got it. _azimuth = (((eyeDirection player) select 0) atan2 ((eyeDirection player) select 1) + 360) % 360; Share this post Link to post Share on other sites
Greenfist 1863 Posted April 29, 2016 I don't quite follow you. You want to know the eye direction in degrees? [0,0,0] getdir (eyeDirection player) Wait. That gives odd results; if you freelook, it doesn't go beyond +-60 degrees from body direction.... Must be meant for AI units, whose necks are a bit stiffer. Edit. [0,0,0] getdir getCameraViewDirection player is better. Or maybe: (positionCameraToWorld [0,0,0]) getdir (positionCameraToWorld [0,0,1]) Share this post Link to post Share on other sites
tortuosit 485 Posted April 29, 2016 My code works, but oh, I have overlooked "getdir", which makes life easier :) Thx. [0,0,0] getdir getCameraViewDirection player Is good :) Share this post Link to post Share on other sites