CFrame.LookAt() only to the sides

Basically, I want to move a model only to the sides with LookAt().

It works perfectly, however, when I am at a higher ground, the turret faces up, so, how would I make it rotate only to the sides and disregard vertical positions?

Here’s the current code:

local lookAtPoint = CFrame.lookAt(Artillery.PrimaryPart.Position, Reticle.Position)
local lerped = Artillery.PrimaryPart.CFrame:Lerp(lookAtPoint,0.02)
Artillery:SetPrimaryPartCFrame(lerped)

Thank you for reading :slight_smile:

I believe all you do is just get the X and Z of the reticle and the Y of the artilery primarypart

local lookAtPoint = CFrame.lookAt(Artillery.PrimaryPart.Position, Vector3.new(Reticle.Position.X,Artillery.PrimaryPart.Position.Y,Reticle.Position.Z))
2 Likes