I'm not sure how those games handle radial menus, but I'll give you my insight.
input.Delta only changes when the mouse is locked (only using a mouse of course). You can lock it by changing MouseBehavior, check the wiki here.
Getting Delta Without Mouse Being Locked
To find the direction a mouse is traveling, you'd want to track the position of the old mouse and compare it with the new mouse.
local UserInputService = game:GetService('UserInputService')
local previousPos
UserInputService.InputChanged:Connect(function(input, gpe)
if (input.UserInputType == Enum.UserInputType.MouseMovement) then
local newPos = Vector2.new(input.Position.X, input.Position.Y)
previousPos = previousPos or newPos
local direction = newPos - previousPos
print(direction)
previousPos = newPos
end
end)
You can also check the magnitude of the direction, that way you have to move your mouse a lot in order to trigger an area.
Alternatives
The use of a mouse moving a certain direction to trigger UI elements is such a strange design that I don't think this is the solution you were looking for. Therefore, I've decided to add more.
Option 1
If you have a radial menu that appears anywhere on the screen and you want an arrow to point to where the mouse is, you'll want to instead take the radial menu's center which you can refer to by GuiObject.AbsolutePosition. Then you subtract the mouse's current position to get a direction which you can apply to the arrow.
Option 2
You can continue to use input.Delta by making the radial menu pop up and locking the mouse in its current position (more info on the MouseBehavior wiki).
Concluding
You need to use math to figure out which element of your UI is in-use. You can use multiple slope equations (learned in school) to find if the mouse is between a certain part. You can also map out angles, converting deltas to angles and comparing from there.
Hope this helps and good luck!
1 comment
How are you locking your mouse's movement?