I am creating a gun-like thing and I’m trying to get this laser beam to be positioned correctly. I have it rotating correctly, but it’s position is slightly off and I’m sure my math is just way off but I’m confused.
It works when my mouse is directly ahead of me and I have no difference in height, but when I aim down or up at all, it totally messes up.
My code:
local startPos = PointStart.Position
local lookFromPosition = startPos + (PointStart.CFrame.LookVector)
newBeam.CFrame = CFrame.lookAt(lookFromPosition, mousePos)
What is happening (The position offset is inconsistent):
What I am trying to make it like: