BézierTweening | Simple tweening along bezier curves

Any chance this could be used or updated to tween movement of the attach1 CFrame being tweened to move foward on the Z axis? Similar to a charge up bow and arrow system where the arc updates/tweens over time accurately with the attach1 of the beam being tweened forward at the same time?

1 Like

you should probably use body movers for this

1 Like

Hey, sorry to bump

There’s a big issue I run into where higher framerate causes tweens to complete far sooner than specified in the function.

How do I make the part look at the next position it’s gonna be? I don’t know where to change it’s orientation to make it look at it’s next position. Help would be appreciated

1 Like

I feel silly for asking this, but can you provide an example of a Tween.Completed event? Great script by the way.

Just do:

local BezierTween = require(ServerScriptService.BezierTween)
local Waypoints = BezierTween.Waypoints
local P0, P1, P2, P3 = workspace.P0, workspace.P1, workspace.P2, workspace.P3
local Part = workspace.Part

local Tween = BezierTween.Create(Part, {
    Waypoints = Waypoints.new(P0, P1, P2, P3),
    EasingStyle = Enum.EasingStyle.Sine,
    EasingDirection = Enum.EasingDirection.In,
    Time = 5,
})

Tween.Completed:Connect(function()
     print('Completed!')
end)
3 Likes

…and the answer was silly simple, thank you.

How would I use this to tween the camera? I’m trying to create a spectate system using this library
I have this code right now but it errors:


local Bez = require(script.Parent.BezierTweens)
local Waypoints = Bez.Waypoints

script.Parent.MainFrame.TextButton.MouseButton1Down:Connect(function()
	local CameraPart = Instance.new('Part', workspace)
	CameraPart.CFrame = workspace.CurrentCamera.CFrame
	
	local OtherPlayer
	for i, v in pairs(game.Players:GetPlayers()) do
		if v ~= game.Players.LocalPlayer then
			OtherPlayer = v
		end
	end
	
	local waypoints = Waypoints.new(CameraPart, OtherPlayer.Character.Head)
	
	local tween = Bez.Create(workspace.CurrentCamera, {
		Waypoints = waypoints,
		EasingStyle = Enum.EasingStyle.Quad,
		EasingDirection = Enum.EasingDirection.Out,
		Time = 1,
	})
	
	tween:Play()
end)

Error:
Position is not a valid member of Camera "Workspace.Camera"

Does anyone know how to properly tween the camera with this library? Any help would be appreaciated

Camera doesn’t use Position, it only operates with CFrame.
I could be wrong but I think the best way to do this is attaching the camera to a part or attachment, then maneuver the part

No support for GUI tweening?

4 Likes

Please add support for things like orientation and custom properties like fov so I can animate the camera, it would be helpful

3 Likes

Why are the Client-Side and Server-Side positions not equal…?

Is it possible to use positions or CFrames instead of parts for p0, p1, p2 and p3?

Says it needs to be a BasePart. I am sure you could modify the Module to accept Udim2

Any way to get this to work with models?

Is there any way to make the part look at the position it’s going to?

I know this module is not being updated anymore, but it is needed in my project.

I’m having an issue playing these tweens on the client. I noticed that if there were two players that creates and plays a bezier tween on the same part, they won’t start at the same time. The player that you have your window focused on will always start first and have the smoother tween.

I don’t know if this only exists while testing on Studio, but this made me worried that it could happen on a live server. It’s important that these tweens start and finish at roughly the same time because I create consecutive bezier tweens. If not, the other player will experience jittering issues.

If anyone can confirm this or find a work around let me know!

I know this post is old, but I would like to add this for anyone who wants to use this with models.
at Line 100 of the BezierTweens Module change this

self.Instance.Position = graphPoint(alpha, unpack(self.TweenInfo.Waypoints))

to this

if self.Instance:IsA("BasePart") then
	self.Instance.Position = graphPoint(alpha, unpack(self.TweenInfo.Waypoints))
elseif self.Instance:IsA("Model") then
	self.Instance:PivotTo(CFrame.new(graphPoint(alpha, unpack(self.TweenInfo.Waypoints))))
end

This should allow you to tween models as long as you are tweening the position of the primary part of the model

Edit: Changed SetPrimaryPartCFrame() to PivotTo() as @pankii_kust said SetPrimaryPartCFrame is unoptimized

1 Like

PivotTo exists,.,.,…,.,.,
SetPrimaryPartCFrame is so unoptimized here, it uses more network data

Thanks for letting me know, I changed it now and tested it. It works for me