I'm currently working on a game based on MORDHAU, a game by Triternion.
One of the main elements in MORDHAU is its melee combat. I'm currently trying to have the players crosshair turn in the same direction as the mouse's movement.
I have all the GUI elements in place, all I need to figure out is how I'd approach changing the orientation of the ImageLabel with the mouse's movement, which shows the player which direction they'll swing.
Is this possible, and if so, how should I go about it?
Edit:
I've started a basic version with a horizontal and vertical response, which seems to be working fine.
userinput.InputChanged:connect(function(inputObj)
if (inputObj.UserInputType == Enum.UserInputType.MouseMovement) then
local dx = inputObj.Delta.X;
local dy = inputObj.Delta.Y;
print("UI: (" ..
tostring(dx) .. ", " ..
tostring(dy) .. ")"
);
if dx > 0 and dy == 0 then
crosshair.Rotation = 0
elseif dx < 0 and dy == 0 then
crosshair.Rotation = 180
elseif dx == 0 and dy > 0 then
crosshair.Rotation = 90
elseif dx == 0 and dy < 0 then
crosshair.Rotation = -90
end
end
end)

2 comments
Thanks for the quick reply, however, this is not what I'm looking for. What I'm trying to pull off is to rotate the mouse based on the previous movement of the camera. I've found a way to kind of pull this off already, however, it's jittery and sometimes buggy.
Oh, alright. I'll see if I can do that!