Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Making a locked custom 3rd person camera?

Asked by
aiuis 85
7 years ago

What I've gotten so far:

01Local Lock=false
02 
03game:GetService'UserInputService'.InputBegan:Connect(function(Input)
04    if Input.KeyCode==Enum.KeyCode.Q then
05        if Lock==false then
06            Lock=true
07        else
08            Lock=false
09        end
10    end
11end)
12 
13while wait()do
14    if Lock==true then
15        game:GetService'UserInputService'.MouseBehavior=Enum.MouseBehavior.LockCenter
16    end
17end

This does the half job - it locks the camera and centers the cursor. However it requires right click to rotate the camera which I'd want to rotate just by moving the mouse itself. I'm not the best when it comes to math and camera manipulation is new for me but I want to learn. I've seen a few people bringing up this question but none were answered correctly so I need your help plox!

1 answer

Log in to vote
0
Answered by 7 years ago

get the mouse's Delta X and Delta Y values and rotate it with those values

Ad

Answer this question