#Bezier Curve Smoothness
27 messages · Page 1 of 1 (latest)
local function TweenArm(arm)
spawn(function()
local armStartCf = arm.CFrame
local timeElapsed = 0
local rnd = Random.new()
local rndCF = CFrame.new(rnd:NextInteger(-7,7),rnd:NextNumber(-6.5,6.5),rnd:NextNumber(-3,7.5))
local speed = script.Parent:GetAttribute("speed")
local duration = (armStartCf.p - pivotCFrame.Position).Magnitude / speed
local tweenDelay = 0.1
timeElapsed = 0
while timeElapsed < duration do
local progress = timeElapsed / duration
local pointAtTimeElapsed = Bezier_Module:QuadraticBezier(progress,armStartCf.p,(armStartCf * rndCF).p, pivotCFrame.p)
local lookAt = Bezier_Module:QuadraticBezier(progress+0.01,armStartCf.p,(armStartCf * rndCF).p, pivotCFrame.p)
if timeElapsed == 0 then
arm.CFrame = CFrame.new(pointAtTimeElapsed,Bezier_Module:QuadraticBezier(progress+.01,armStartCf.p,(armStartCf * rndCF).p, pivotCFrame.p))
elseif timeElapsed == speed then
local tween = TweenService:Create(arm,TweenInfo.new(.4),{Transparency = 1}):Play()
end
timeElapsed += speed
local tween = TweenService:Create(arm,TweenInfo.new(tweenDelay),{CFrame = CFrame.new(pointAtTimeElapsed,lookAt)})
tween:Play()
game:GetService("TweenService"):Create(arm,TweenInfo.new(duration,Enum.EasingStyle.Quad),{Transparency = 1}):Play()
wait(tweenDelay)
end
arm:Destroy()
end)
end
while task.wait() do
local arm = game.ReplicatedStorage.Arm:Clone()
local Hitbox = V4.new(arm)
Hitbox:SetPoints(arm, {Vector3.new(0, 0, 0), Vector3.new(-0.5, 0, 0), Vector3.new(0.5, 0, 0), Vector3.new(0, 1, 0), Vector3.new(-0.5, 1, 0), Vector3.new(0.5, 1, 0), Vector3.new(0, -1, 0), Vector3.new(-0.5, -1, 0), Vector3.new(0.5, -1, 0)})
Hitbox:HitStart()
arm.Position = script.Parent.Position
arm.Parent = script.Parent
pivotCFrame = CFrame.new(script.Parent.Attachment.WorldPosition)
TweenArm(arm)
Hitbox.OnHit:Connect(function(hit, humanoid)
if humanoid and humanoid ~= Human then
local Damage = math.random(.5,1)
humanoid:TakeDamage(Damage)
end
end)
end
unsmooth very unhappy
first i would take out wait(tweenDelay) and replace with tween.Completed:Wait()
bet
next, show a gif
let me
of it playing
dayum
what difference
whats different from the first and second time
take out tween.Completed:Wait() and replace it with task.wait(tweenDelay*0.9)
or 0.95
alr
try easingstyle linear
I think im tweaking
Which option do you think it is
i'm slowly going insane
or the script is messed up