Hello, everyone who reads this post, I am trying to create a crosshair that is center and when you move your mouse up, it goes up and the same for other directions but I cannot figure out how. I would appreciate any help you can give me. I think star scape uses it for their ships and its exactly what I want to create.
Do you mean something similar to a mouse cursor?
If I understood correctly, you can maybe try to replace the mouse icon. The crosshair would replace the default cursor. Here is a documentation about it.
So I looked up a video for starscape. It looks like what you want is an arrow to point in the mouse direction, and a point in front of the ship (not exactly center screen) to indicate the ship’s forward direction?
For the latter, you can get a point in front of the ship and use Camera:WorldToScreenPoint to get the position on screen where you should place the cursor.
I believe you are talking about the white square movement where the crosshair/GUI moves in the direction of mouse movement (mouse delta)
https://i.imgur.com/t9vqobP.mp4
You could just tween for that
local unitVector2 = Vector2.new(0.482, 0.472) + Vector2.new(input.Delta.X * 0.05, input.Delta.Y * 0.05)
-- Stats
--script.Parent.Parent.Pos.Text = tostring(input.Position)
--script.Parent.Parent.Delta.Text = tostring(unitVector2)
-- Delta Frame
tweenService:Create(script.Parent,
TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut),
{Position = UDim2.new(unitVector2.X, 0, unitVector2.Y, 0)}):Play()
How can I modify it to tween towards its direction in third person? Like how when they move the mouse up the GUI goes up etc.
Pretty sure they just lock the mouse in third person using UserInputService.MouseBehavior to Enum.MouseBehavior.LockCenter.
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
The real cursor is in the center of the screen but theres a fake GUI cursor doing the movements and returning back to center if there is no movement.
Alright I will try this. Thank you
How can I make this look smoother?
tween or lerp the position value like in the example I gave
How can I limit how far it can go?