What should I use for rotation in lerping for a tower defense?

So I want to know what the best rotation would be for a position based lerp. The problem is I can’t figure out what the best one is. I have tried to do tween but the alignment on the position just gets all messed up. I have also tried to do align position and align orientation but those seemed like the object was falling behind unless if someone could explain how to use them better. These are the arrows and not enemies or units.

Code:

local ServerStorage = game:GetService("ServerStorage")
local PhysicsService = game:GetService("PhysicsService")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local events = ReplicatedStorage:WaitForChild("Events")

local arrow = {}

function arrow.LerpTo(newArrow, target)
	local alpha = 0
	local startCFrame = newArrow.Position
	local loop
	local loopBool = false
	local distance = (newArrow.Position - target.Position).Magnitude

	loopBool = true
	loop = RunService.Heartbeat:Connect(function(deltaTime)
		local speed = 40
		local relativeSpeed = distance / speed
		local goalCFrame = startCFrame:Lerp(target.Position, alpha)
		newArrow.Position = goalCFrame
		alpha += deltaTime / relativeSpeed
		if alpha >= 1 then
			loop:Disconnect()
			loopBool = false
		end
	end)

	repeat task.wait()
	until loopBool == false
end

function arrow.Move(newArrow, pathNum, map)
	local waypoints = map:FindFirstChild("Waypoints"..pathNum)
	local newPos
	
	for waypoint=2, #waypoints:GetChildren() do
		newPos = waypoints[waypoint]
		arrow.LerpTo(newArrow, newPos)
	end
	
	newArrow:Destroy()
end

I personally think you’d be best off with the CFrame.
It has built-in methods for lerp.
The CFrame also has combined rotation and position handling.

  • Move the arrow smoothly from one waypoint to the next.
  • Automatically update the arrow’s orientation to point towards the next waypoint.
  • Ensure that both position and rotation changes happen in a coordinated and visually pleasing manner.

hm ok but would i update the cframe at the end to point towards the next waypoint?

Id assume yes, to ensure the arrow is always pointing towards the next waypoint, you could update the CFrame to face the direction of movement towards the next waypoint. You can do this by constructing a new CFrame that points from the current position to the next position.

welp all it took was for me to set the cframe at the end and it works pretty well i think. the only problem i may still have is some of the arrows out of the three get displaced from what they were when spawned.