- Is there a way to prevent Y angle to look up and down when jumping?
game:GetService("RunService").RenderStepped:Connect(function()
local lookAt = CFrame.new(plr.Character.PrimaryPart.Position + Vector3.new(3, 0, 3))
local Target = plr.Character.PrimaryPart.CFrame --* CFrame.Angles(math.rad(45), 0,0)
TestPart.CFrame = CFrame.new(lookAt.Position, TestPart.Position + Target.LookVector)
end)
Forummer
(Forummer)
#2
You could lock the Y component of the camera’s CFrame when jumping.
Luacrative
(Username)
#3
By getting the Y and Z orientation values and then using those to create a new CFrame where the X orientation value is 0, this should work.
game:GetService("RunService").RenderStepped:Connect(function()
local lookAt = CFrame.new(Player.Character.PrimaryPart.Position + Vector3.new(3, 0, 3))
local Target = Player.Character.PrimaryPart.CFrame --* CFrame.Angles(math.rad(45), 0,0)
local Goal = CFrame.new(lookAt.Position, TestPart.Position + Target.LookVector)
local _, RotY, RotZ = Goal:ToOrientation()
TestPart.CFrame = CFrame.fromOrientation(0, RotY, RotZ) + Goal.p
end)