I'm trying to script a 2d compass (based on code I found on internet, not mine) but I'm really not good at maths. If you are please explain to me in simple words or detailed explanations so I can understand and reproduce.
My issues :
1. I can't make it align with north correctly
2. I can't figure out how to change it's width without destroying it's rotation
Size of my picture 4096*4096 pixels.
_worldPos = screenToWorld [0.5,0.5];
_playerPos = getPos player;
_dir = (((((_worldPos select 0) - (_playerPos select 0)) atan2 ((_worldPos select 1) - (_playerPos select 1))) + 360) % 360)/100;
_width = 0.96 * safeZoneW;
_calc = ((_width/570) * _dir)* 100 + (_width/570) * 45;
(ctrlCompass#0) ctrlSetPosition [_calc - _calc*2,0.69 * safezoneH + safezoneY,_width,1.8 * safeZoneH];
(ctrlCompass#0) ctrlSetText "Images\compass.paa";
(ctrlCompass#0) ctrlCommit 0;
}] call BIS_fnc_addStackedEventHandler;