Thanks for the reply. What I think you are suggesting is the following:
I’ve tried this and got weird results with the rotations alternating back and forth between each point. This would be solved by adding more lerping points where the distance is shorter following the lower arc. The problem is that I need to predefine many of these arcs, so I would be polluting my workspace with hundreds and hundreds of reference parts.
If there is no trivial mathematical solution, this is probably what I will do.
What I would do is use a spline to define a “smooth” curve. By essentially defining points along a curve, you can then receive an equation which smoothly fits through these points. Then, parameterize it for a single variable, such as t. You can then iterate from [0, 1] along the curve.
If you are just moving something in a circular manner, you could just use Sine and Cosine to determine the x, y and rotation of the object along the circular path.
You can just change the rotation while lerping. Like this:
local part = workspace.Part
for i = 0,1,0.01 do
part.CFrame = part.CFrame:Lerp(workspace.LerpingPoint1.CFrame * CFrame.Angles(workspace.LerpingPoint1.Orientation),i)
wait()
end
You can lerp the part to the rotation of the sleeping point.
I would avoid doing this if you favor quality over simplicity. While this approach is intuitive and simple, it will visibly stutter as the direction abruptly changes after each waypoint.
gives me an “Argument 3 missing or nil” error and otherwise inputting the angle gives me the same arc as above.
Thanks for the link! I will check out splines and get back to you guys on how my implementation worked. Unfortunately as I mentioned earlier, these two points are not aligned to a circle, more of an ellipse.
Yes I know, I found a way to fix it, but it is not setting it to the exact rotation, to fix it, you can do this:
local lerpedPart = workspace.LerpedPart
for i = 1,#workspace.LerpPoints:GetChildren(),1 do
local part = workspace.LerpPoints:WaitForChild("Lerp".. i)
for j = 0,1,0.01 do
lerpedPart.CFrame = lerpedPart.CFrame:Lerp(part.CFrame * CFrame.Angles(math.rad(part.Orientation.X), math.rad(part.Orientation.Y), math.rad(part.Orientation.Z)), j)
wait()
end
end
I am not sure if the math.rad is needed, but I am testing something with it.
Edit: I’m fairly certain that multiplying a CFrame by its own angles is just going to transform it into a different CFrame that is not the desired outcome.
I would avoid using CFrame.Angles. You can just directly extract out the rotational component of the CFrame. If you really want to go from CFrame->Angles->CFrame, you should extract the angles directly from the CFrame and not use Orientation property.