#Gui Scripting this eyeball thing
1 messages · Page 1 of 1 (latest)
firstly is the pupil a seperate image to the eye
yes
ok good umm id have to think about this lol
First thing that comes to mind, map out the screen's pixels to the eye's range. Say your screen is 1920x1080 and the eye's full range of motion is from 50 to 100. Essentially, if the cursor is at pixel 0,0 of the screen, we'd want the eye to be at 50,50 as well (top left corner) and if the cursor is at pixel 1920,1080, then the eye should be at pixel 100,100 (bottom right corner)
All you need to do now is get the percentage of where the cursor is relative to the screen. For example...
If the cursor is at pixel 960,540 (center of the screen), thats 50% of the total width and height, now, just plug that into the eye's range. What's 50% (middle) of 50,50 and 100,100? 75,75. The eye should be at pixel 75,75
woah all these numbers and calculations is giving me a headache 
My stupid dumb way would be to put a bunch of invisible buttons and 'button.MouseEnter:Connect them to tween the eye into the direction of the buttons but i wouldn't do that
Hahah its easier to show it visually than explain it, and im a bad explainer 😂
lowk thats creative alternative but nots very optimal i think hahah
im mostly a game systems scripter, gui is hard cuz there is so much more math and numbers it seems (depending on what you're doing i guess)
i was thinking, what if i can make it follow the mouse but have it bound inside the primate of the image below it (the eye), that might just be what you were saying but in a smarter way 😭
Yep youre basically halfway to what im trying to say lol
But instead of following the mouse by having it directly under it, you get the percentage of where it is in the screen and map it to the eye and its location in the eye socket
hmm okok lemme go play around with it for a moment, thanks kyu and alex :D
So basically you want something like this?
yess omllll i havn't tried anything much yet because i just got back from the store lol
There is one small problem with the thing I did there, though. You'll have to scale the "range' to the screen, or it will cause small problems with other devices/resolutions
i think kyu mentioned something like that, needing to get the size of the screen 🤔