I want to know how to use EasingStyle when using Vector3:Lerp()
StartPosition:Lerp(EndPosition,Type(a/t,Interp))
Where Type() is this function
local function Type(linearAmount,Interp)
if Interp == nil or Interp == "Linear" then
return linearAmount
elseif Interp == "Sin" then
return math.sin(linearAmount*math.pi/2)
elseif Interp == "Sout" then
return (math.asin(linearAmount)*2)/math.pi
elseif Interp == "Sinout" then
return (-math.cos(math.pi*linearAmount)+1)/2
end
end
As you see I have made some math functions that interpolate for me, but I noticed my arm does not have any weight to it, but creating a function for the more complicated Easingstyles (bounce) would be impractical, not to mention all the in, out, and inout variants.
If you want to know why I can’t use tweens, here is the whole function
module.Linear.MoveEndBallToPoint = function(EndPosition,Speed,ClawPointPosition,Interp)
if LinearConnection then LinearConnection:Disconnect() end
local StartPosition = SmallBall.Position
local t = (StartPosition-EndPosition).Magnitude/Speed
local a = 0
BreakEnd = false
if typeof(ClawPointPosition) == "Vector3" then
ClawPointPosition = CFrame.new(ClawPointPosition)
end
LinearConnection = RS.Heartbeat:Connect(function(dt)
a += dt
if a>t then a = t end
Instant(GetAnglesToPosition(StartPosition:Lerp(EndPosition,Type(a/t,Interp)),3),3)
if ClawPointPosition then
JointTable[4].C0 = GetJointAnglesToPointPointerAtTarget(JointTable[4],ClawPointPosition,EndPartTable[4])
end
if a == t then LinearConnection:Disconnect() end
if BreakEnd then LinearConnection:Disconnect() end
end)
end
(I need to run Instant(GetAnglesToPosition()) every frame)
Is there any way to do this? Or am I stuck with making math functions.