You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
Basically I am trying to create a crosshair, which grows the faster your mouse is. Sort of like this. 2023-12-06 23-54-26
What is the issue?
I cannot figure out a way to overcome this obstacle, do you have any ideas? I would really appreciate some example as well!
This is my progress
What solutions have you tried so far?
As of now I’ve been ravaging throughout the internet, trying to find a solution. But haven’t found anything.
This is how I could calculate the speed of the mouse. (X pixels per 1/10th second)
“Found this in another dev forum”
local Mouse = game.Players.LocalPlayer:GetMouse()
local LastPosition = Vector2.new(0,0)
while wait(0.1) do
print(math.floor((Vector2.new(Mouse.X, Mouse.Y) - LastPosition).Magnitude + 0.5))
LastPosition = Vector2.new(Mouse.X, Mouse.Y)
end
The speed itself can be used as distance, but maybe only use a fraction of it… there could also be more proper methods, but we don’t have much context, is this a first-person game or third-person over-the-shoulder style game?
--general idea
imageDistance = mouseSpeed / 2 --play with this value.
NewBottomRightImagePosX = OriginalBottomRightImagePosX + imageDistance
NewBottomRightImagePosY = OriginalBottomRightImagePosY + imageDistance
--repeat for other images.
You could use the AssemblyLinearVelocity of the character’s humanoidrootpart which returns the current vector3 direction the player is moving. Or you could use MoveDirection which is the vector3 direction that the player is TRYING TO MOVE IN.
For both properties you can write MoveDirection.Magnitude to return a value measures the value, essentially the hypotenuse of a pyramid