Get the angle of the mouse relative to the center of the screen, then just check if the angle is within the interval that defines the boundary that you wish to detect it inside.
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local Client = Players.LocalPlayer
local Camera = Workspace.CurrentCamera
local Mouse = Client:GetMouse()
local Frame = script.Parent
local function MouseMoved()
local X, Y = Mouse.X, Mouse.Y
local W = Camera.ViewportSize / 2
local Angle = math.atan2(Y - W.Y, X - W.X) -- angle will be between [-180, 180] such that quadrant 1 is defined as [-math.pi / 2, 0]
if Angle < 0 and Angle > -math.pi / 2 then
print("We are inside Quadrant 1!")
end
if Angle < 0 and Angle > -math.pi / 4 then
print("We are in Octant 1!")
elseif Angle < -math.pi / 4 and Angle > -math.pi / 2 then
print("We are in Octant 2!")
end
end
Mouse.Move:Connect(MouseMoved)
Thanks, i was thinking of something similar, just so happens I kinda didn’t get how to implement the math part of it. And for the middle I’m just gonna use the camera.viewportsize/2 to check distance from middle. On a side note I’m planning to use this for a combat system