Bezier curve not distributed equally

Ciao, i’m trying to make a bezier curve using 3 points. So i can make a dummy walk along a curve.

There’s a problem tho. You can see that in the curve the parts are more concentrated near the end rather than equally.
image
Anyone got a solution?

I tried searching around for solutions but i don’t understand them. Thanks for reading.

1 Like

Is that an issue? You could just calculate the distance to the next node, and multiply it by the speed or the NPC, and move it to the next node. I’m not sure hoe to fix this, but this should give the same effect.

1 Like

I believe it’s kind of an issues.
To move the dummy along those curve points i would use a for cycle, so the dummy would result slower near the end

1 Like

If you are using tweens, you would get the distance from this Node, to the next one, lets say (1), and multiply/divide it by speed, and you should get the time to tween. So to start, if the next node was 5 studs away, and the speed was 2, you would get 5/2 = 2.5, and that would be the time of the tween.

But for the closer ones, say .25 studs apart, .25/2 would give you .125, which would result in the same speed. You just need to multiply/divide distance by speed, and you should be good. How are you moving the NPC?

1 Like

Usually i used the TweenService, but the path always looked like it was going into a linear direction.

--Cammina
	TweenService:Create(	
		Temp,
		TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In),
		{CFrame = Posto.CFrame}
	):Play()

	--Cammina
	while Temp.CFrame ~= Posto.CFrame do
		Clone:SetPrimaryPartCFrame(Temp.CFrame)
		wait(0.01)
	end
	Clone:SetPrimaryPartCFrame(Posto.CFrame)

I am trying to make a method to have the NPC move in a curve, but i have no idea how to do so. I tried with a for cycle around the parts of a curve changing the CFrame, but it looks off and robotic.

I heard for smooth moving and rotating, you could use lerping, but I’m not sure how to do that, and with many Npc’s it may be more performance heavy than tweens.

1 Like

I have the perfect post for you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.