just for demonstration, ima make 2 CFrame value, but it will be unknown in the actual case
a1 = (0,0,0)
a2 = (0,10,0)
and i want a function that when i input the 2 CFrame value, and a number, for example 4, it will return the values between those 2 CFrames sth like (0,2,0) (0,4,0) (0,6,0) (0,8,0)
It’s rather simple really, there is a lerp function for that!
local function getInbetweens(cf1,cf2,amount)
local step = 1/(amount+1)
local currStep = step
local cframes = {}
for i = 1,amount,1 do
table.insert(cframes,cf1:Lerp(cf2,currStep))
currStep += step
end
return cframes
end
print(getInbetweens(CFrame.new(0,0,0),CFrame.new(0,10,0),4))
This also works for rotation, so if you don’t want to get the rotation coordinates with it you will have to adjust this a little bit.