How to get a CFrame between two positions?

I am making a beam move in my game and for the hitbox I need to get the CFrame between 2 positions so I can properly size the hitbox for the beam. How can I do this? A CFrame where the lookvector is facing the direction the beam is shooting.

You can get the cframe between the 2 positions like this:

finalposition.CFrame = part1.CFrame:lerp(part2.CFrame,0.5) 

0,5 is the midpoint between the points

2 Likes
local function getmidcframe(cframe1, cframe2)
  local distance = (cframe.Position - cframe2.Position).Magintude/2 -- get halfway 
  local cframe = CFrame.lookAt(cframe1.Position, cframe2.Position)  -- look at cframe
  return cframe * CFrame.new(0,0, distance) -- add together and return
end
2 Likes