# Getting points between 2 CFrames

so i got 2 CFrames

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)

How do i do that

(c1 + c2)/2 midpoint formula

If this syntax doesn’t work you may have to do the math with each variable like x, y, z

For a specefic point do this

print(Cframe1:Lerp(Cframe2, 0.4))

0.4 means 40% from cframe1 to cframe2

1 Like

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.