EXM_0
(yuno)
February 15, 2021, 6:22pm
#1
So I’m currently testing my dynamic crosshair and I’m pretty confused with this problem
This is my code, I’m pretty sure it should work work. (crosshair.Up.Position
is {0.5, 0},{0, 0}
)
local upPost = crosshair.Up.Position:Lerp(UDim2.new(0.5, 0, -1, 0), deltaTime)
crosshair.Up.Position = upPost
And then if I’m ‘lucky’ enough it’ll function as it’s supposed to be. I’m really confused
(This code is inside a RenderStepped loop)
Its supposed to go from the white box to it’s goal. Instead it comes from OFF the screen to its goal as showed:
https://gyazo.com/4c3e9e6c534b92b267021aaa1c6d59eb
Thanks in advance!
nicemike40
(nicemike40)
February 15, 2021, 9:13pm
#2
How do you want the crosshair to actually behave? Should it:
Move towards its goal at a consistent speed?
Always remain at a fixed percentage distance between its start position and the goal?
Move quickly towards its goal at first, but slow as it gets closer?
I’m pretty sure lerping is for cframes, have you tried using TweenService?
If it’s a gui object, you can just use crosshair.Up:TweenPosition(UDim2)
1 Like
EXM_0
(yuno)
February 16, 2021, 1:59am
#5
It’s basically going to its goal in the wrong direction. It’s supposed to go from 0 to -1 but sometimes it goes from -3 to -1 for no reason. (example showed above)
EXM_0
(yuno)
February 16, 2021, 2:01am
#6
I prefer to not use TweenPosition because it’s going to be a dynamic crosshair and the values will be changed quite frequently