#Epic bezier smoothness fail

78 messages · Page 1 of 1 (latest)

hoary bolt
#

a

#
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,Enum.EasingStyle.Quad),{CFrame = CFrame.new(pointAtTimeElapsed,lookAt)})
            tween:Play()
            game:GetService("TweenService"):Create(arm,TweenInfo.new(duration,Enum.EasingStyle.Quad),{Transparency = 1}):Play()

            task.wait(tweenDelay*0.95)
        end
        task.wait(.5)
        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()
    Hitbox.Visualizer = false
    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)
    task.wait(.6)
end
#

Link if you want to see how it looks

real anvil
#

Explain the code dude

#

Explain what's not working

knotty vigil
#

no fuck you grunk

real anvil
#

Add debug prints

knotty vigil
#

it's not smooth

real anvil
hoary bolt
#

🤯

#

Mind blowing

real anvil
hoary bolt
#

Go away

real anvil
#

Yeah, my professional opinion is that this code looks doo doo ass

hoary bolt
#

Good

#

Never asked for your opinion

#

i'm only testing stuff

knotty vigil
#

nah i can't read this code

#

sorry i don't have an ultra wide monitor

hoary bolt
#

oo no

real anvil
#

@hoary bolt why are you S1?

#

You should be at least S2 with this

hoary bolt
real anvil
#

Apply for S2

hoary bolt
#

no

#

the code is ass

#

on life support

hoary bolt
#

Save me

#

Please

mellow stream
#

Do you still need help

hoary bolt
mellow stream
#

What is the problem exactly

hoary bolt
#

The part movement along the bezier curve

#

doesn't look smooth

real anvil
hoary bolt
#

Neither do i understand why

#

lemme

#

show you

#

For me

#

it looks choppy

knotty vigil
#

set network owner to the player

#

actually no

#

do it on the client

#

instead of the server

hoary bolt
#

Whats the difference

knotty vigil
#

reduces server load

#

looks smoother on client

mellow stream
#

Okay, it doesn't look choppy to me but here are some ways you can improve it. First thing is to use the task library for your spawn it will make more of them. Second thing is to use delta time, multiplying by the time since the last wait will make it linked to the rate between movements making it appear smoother. task.wait returns the delta time value.

#

Oh

#

It's on server?

knotty vigil
#

yes

mellow stream
#

Yeah definitely never put your effects on the server.

hoary bolt
#

I know

#

I was just testing it

#

if i can achieve a similar effect

#

and then I looked at it, and it didn't look as i wanted

knotty vigil
#

just do it on client, problem solved

mellow stream
#

Doing it on the client will make it so it doesn't have to replicate and the delay will be more consistent making it appear more smooth. You can also tie it to renderstepped and use deltatime to tie it to the render rate making it actually smooth.

knotty vigil
#

^

hoary bolt
#

Thanks for the help.

knotty vigil
#

if this is solved please close ur post

real anvil
#

Oh, I get it

#

Is this your code?

hoary bolt
real anvil
#

Right, that's why you're S1

hoary bolt
#

That's a video

real anvil
#

Makes sense

hoary bolt
#

indeed

real anvil
#

Close the thread if you've solved it

knotty vigil
#

i just said that

real anvil
hoary bolt
#

Working on it

real anvil
#

Work faster