I’ve got an animation from a friend of mine to use, the animation was build for 60fps and when its over 60 fps animation becomes weird. I have read on some devforum posts that I have to multiply by dt - delta time but im not sure what to multiply.
local playerChar = self.Owner.Character
if not self.Owner.Character or not self.Instance.PrimaryPart or not self.Owner.Character.PrimaryPart or not playerChar:FindFirstChildOfClass("Humanoid") then
return
end
local target = self.Owner.Character.PrimaryPart.Position + self.Offset
local Next0 = (self.Position:Lerp(target, 0.1) * Vector3.new(1, 0, 1))
local Next1 = (self.Position:Lerp(target, 0.3) * Vector3.new(0, 1, 0))
local Next = Next0 + Next1
local moving = playerChar:FindFirstChildOfClass("Humanoid").MoveDirection.Magnitude > 0
local now = tick()
local angle = (now + self.Phase) % (math.pi * 2)
local animation = CFrame.new(0, 0.25, 0)
local twist = CFrame.new()
if self.Flying then
local cframe = CFrame.new(0, 3, 0)
local anim = CFrame.Angles(math.rad(math.cos(angle * 4)) * 8, 0, 0)
local anim2 = Vector3.new(0, math.sin(angle * 4) * 0.5, 0)
animation = cframe * anim + anim2
end
if moving and not self.Flying then
local animationIntensity = math.clamp((ToVector2(Next) - ToVector2(target)).Magnitude, 0, 4.5) / 4.5
local y = math.abs(math.sin(angle * 10)) * 3 * animationIntensity
local r = math.rad(math.sin(angle * 10)) * 20 * animationIntensity
animation = CFrame.new(0, y, 0) * CFrame.Angles(0, 0, r)
end
if moving then
twist = CFrame.new(Vector3.new(), self.Owner.Character.PrimaryPart.CFrame.LookVector)
else
twist = CFrame.new(Vector3.new(), ((Next0 * -1) + (self.Owner.Character.PrimaryPart.Position or Vector3.new())) * Vector3.new(1, 0, 1))
end
self.Twist = self.Twist:Lerp(twist, 0.1 * 0.5)
self.Animation = self.Animation:Lerp(animation, 0.3 / dt)
self.Position = Next
if self.ModelWrapper then
self.ModelWrapper:SetCFrame(CFrame.new(self.Position) * self.Twist * self.Animation)
end
here is the animation, if you could help me out would really appreciate.