Flash-Ranger 195 Posted May 29, 2019 Hello all, 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. Share this post Link to post Share on other sites
sarogahtyp 1109 Posted May 29, 2019 I don't get the math in it but I guess _dir could be just _dir = getDir player; EDIT: strikethrough Share this post Link to post Share on other sites
Flash-Ranger 195 Posted July 20, 2019 Up ? Any one to help ? Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted July 20, 2019 Why use math? disableSerialization; MyCompass = findDisplay 46 ctrlCreate ["RscPictureKeepAspect", -1]; MyCompass ctrlSetPosition [0.5,0.5,.1,.1]; MyCompass ctrlSetText "\A3\ui_f\data\map\markers\handdrawn\arrow_CA.paa"; MyCompass ctrlCommit 0; addMissionEventHandler ["EachFrame",{ MyCompass ctrlSetAngle [getDirVisual player, 0.5, 0.5]; }]; You can get around the serialization error message by using "with UInamespace do", depends on how you set it up. Cheers Share this post Link to post Share on other sites
Flash-Ranger 195 Posted July 20, 2019 Because my 2D compass is Horizontal linear. I want it to slide left or right depending on the orientation of the player Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted July 20, 2019 15 minutes ago, Flash-Ranger said: Because my 2D compass is Horizontal linear. I want it to slide left or right depending on the orientation of the player Use linear conversion then? You're not really specific about what you want. When the bearing is 0 the slider should be full left, at 360 full right? Could be something like this: _dir = getDirVisual player; _newMin = minPositionX;//some x coordinate the image should have when the player bearing is 0 _newMax = maxPositionX;//some x coordinate the image should have when the player bearing is 360 _positionX = linearConversion [0,360,_dir,_newMin,_newMax,true]; Cheers Share this post Link to post Share on other sites
Flash-Ranger 195 Posted July 20, 2019 It's fine, I re-read myself I found my own mistakes 😞 silly me ! Sorry for the bother. A Mod can delete this topic ! 1 Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted July 20, 2019 7 minutes ago, Flash-Ranger said: It's fine, I re-read myself I found my own mistakes 😞 silly me ! Sorry for the bother. A Mod can delete this topic ! Why not share how you solved your issue? Deleting topics won't help others that might run into similar issues. Cheers 4 Share this post Link to post Share on other sites
Larrow 2823 Posted July 20, 2019 https://github.com/LarrowZurb/Compass 4 Share this post Link to post Share on other sites
ZaellixA 383 Posted July 21, 2019 Yep, sharing your solution is the best thing to do around here 1 Share this post Link to post Share on other sites