Hello All,
I am trying to write a camera script that will point the player's camera at the mouse's position. I have been unsuccessful so far. The camera spins uncontrollably with both of the following scripts.
function rotate () local pos = UIS:GetMouseDelta() local ray = cam:ScreenPointToRay(pos.X, pos.Y, 3000) local point, targPos = game.Workspace:FindPartOnRay(ray) cam.CFrame = CFrame.new(craft.Value.CG.Position - craft.Value.CG.CFrame.lookVector + Vector3.new(0,8, -8), targPos) cam.Focus = CFrame.new(targPos) end
The above code spins faster and is far more uncontrollable than the code below.
function rotate () local pos = UIS:GetMouseLocation() local ray = cam:ScreenPointToRay(pos.X, pos.Y, 3000) local point, targPos = game.Workspace:FindPartOnRay(ray) cam.CFrame = CFrame.new(craft.Value.CG.Position - craft.Value.CG.CFrame.lookVector + Vector3.new(0,8, -8), targPos) end
The camera mode is scriptable and the function is bound to RenderStep. How would I go about solving my problem?
Thanks,
Ion