I’m working on project right now and I want to have a part locked to the camera’s position, but have the rotation smoothed. I know how to use lerping to get this effect, but the issue comes in when I want it to sort of overshoot the goal similar to the “Back” EasingStyle. Any help with this is appreciated, thanks :>
1 Like
Could try TweenService:GetValue()?
1 Like
How would I go about applying it to a function that updates on RenderStepped?
1 Like
After looking for a bit, I found this module that works really well for what I’m trying to do.
1 Like
Try mess around with this code:
local start = 0 --start
local goal = 5 --goal
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local value = 0
local elapsed = 0
local cnStepped
local function onStepped(t, dt)
elapsed = math.min(elapsed + dt, tweenInfo.Time)
local alpha = game:GetService('TweenService'):GetValue(elapsed / tweenInfo.Time, tweenInfo.EasingStyle, tweenInfo.EasingDirection)
value = start + (goal - start) * alpha --you might recongize this: it's the equation for a lerp
print(value)
if elapsed >= tweenInfo.Time then
cnStepped:Disconnect()
end
end
onStepped = game:GetService('RunService').Stepped:Connect(onStepped)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.