Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why doesn't the Mouse align with the camera?

Asked by 7 years ago

So I scripted something that should make the camera look at a part with CFrame.new(cam.Position,part.Position).

However, the mouse appears slightly above the part. That means that the mouse icon isn't actually in the middle of the screen when a player is zoomed in. Why not and any fixes?

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I found more about what you were talking about with your forum post here.

The problem, from my perspective, seems to be that the mouse is scaled from the WHOLE screen, with the topbar. Regular GUIs are not scaled with the topbar in account.


Accounting for the top bar

To get the GUI to be where the mouse would be in zoomed in mode, we have to know the size of the top bar. The tobbar is measured in offset, pixels, and measures to be about 35 pixels.

If we divide this by two to get half, we then subtract the centered GUI's offset by this new number. Because we can't put .5 of a pixel, I rounded down to 17.

Here's a link to a picture demonstration.

Good Luck

if I helped, please don't forget to accept my answer.
0
Actually, round up to 18 pixels for best results :3 User#11440 120 — 7y
Ad

Answer this question