It's pretty self explanatory. So far, I've slapped down this hastily made code into a StarterCharacter's animate script.
local UserInputService = game:GetService("UserInputService") local Character = script.Parent local cam = workspace.CurrentCamera local deltax = 0 local deltay = 0 local pose = "Standing" game:GetService("RunService").Heartbeat:Connect(function() if pose == "Running" and Character then if Character:FindFirstChild("Head") then cam.CFrame = CFrame.Angles() + Character.Head.CFrame.p --I don't know what to put here end end end) UserInputService.InputChanged:connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseMovement then deltax = inputObject.Delta.x deltay = inputObject.Delta.y end end) --there's obviously more to the script, I just only put in what I'm using for this part
I want to make it so that the camera's position is attached to the head, but whenever the player moves their mouse (or whatever) they can still look around like in first person.
Problem is, I'm literally in middle school and have no idea how to convert 2D movement onto a 3D plane.
Any help?
You can make the Camera be 1 stud in front of the Player's head by doing this.
cam.CFrame = Character.Head.CFrame * CFrame.new(0,0,1)
By setting the camera's CFrame to the Character's Head's CFrame you place them in exactly the same position and same rotation. When you want to add CFrames, you use multiply instead, so I'm effectively just adding 1 onto the Position of their head, you can change it and experiment to see what you like best.
For the camera looking like it's still in first person, that shouldn't happen anymore since it's being set to that position constantly.
I am 99% sure this will work :) If it doesn't you can shoot me a message and if I see it I'll answer it. (I'm not on scripting helpers much)