You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? A viewmodel pointing to a certain vector3 position
-
What is the issue? I don’t know why, but on one side it acts normally, but if I turn around it freaks out.
-
What solutions have you tried so far? I tried doing CFrame.LookAt, but as you might guess it, it didn’t work.
run.RenderStepped:Connect(function()
if isHooking and currentPos ~= nil then
local _, inViewport = cc:WorldToViewportPoint(currentPos)
if inViewport then
lerpCF = lerpCF:Lerp(CFrame.lookAt(cc.CFrame.Position,Vector3.new(vm.PrimaryPart.Position.X,currentPos.Y,currentPos.Z)).Rotation:Inverse(),0.2)
else
lerpCF = lerpCF:Lerp(CFrame.new(),0.2)
end
else
lerpCF = lerpCF:Lerp(CFrame.new(),0.2)
end
vm:SetPrimaryPartCFrame(cc.CFrame * lerpCF)
end)
(current position is Mouse.Hit.Position, and cc is workspace.CurrentCamera)