#how to check if cframe lerp has completed?
1 messages · Page 1 of 1 (latest)
while self.aimcf ~= targetcf
does this work? self.aimcf = self.aimcf:Lerp(targetcf, dt * 10):Wait()
it doesnt work
no
Okay thanks to hear
Check the dev forum for info
if (self.aimcf.Position - targetcf.Position).Magnitude < 0.05 then
end
nvm i just made my own tween-style CFrame lerp that can be canceled
local startTime = os.clock()
self._aimLerpCon = self.janitor:Add(RunService.RenderStepped:Connect(function(deltaTime: number)
local alpha = math.clamp((os.clock() - startTime) / (deltaTime * 15), 0, 1)
local interp = self.aimCF:Lerp(self.aim, alpha)
self.aimCF = interp
if alpha >= 1 then
self.janitor:Remove("AimLerpConnection")
self._aimLerpCon:Disconnect()
self._aimLerpCon = nil
end
end), "Disconnect", "AimLerpConnection")
