im making a camera system like Gta style but when i rotate it on mobile it doesnt rotate but it does have the shoulder cam tho
local xAngle = 0
local yAngle = 0
userInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
xAngle = xAngle-input.Delta.x*0.4
--Clamp the vertical axis so it doesn't go upside down or glitch.
yAngle = math.clamp(yAngle-input.Delta.y*0.4,-20,20)
end
end)
runService.RenderStepped:Connect(function()
if Character and Character:FindFirstChild("HumanoidRootPart") then
userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local rootPart = Character:WaitForChild("HumanoidRootPart")
local startCFrame = CFrame.new((rootPart.CFrame.p + Vector3.new(0,2,0)))*CFrame.Angles(0, math.rad(xAngle), 0)*CFrame.Angles(math.rad(yAngle), 0, 0)
local cameraCFrame = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,cameraPos.Z))
local cameraFocus = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,-50000))
Camera.CFrame = CFrame.new(cameraCFrame.p,cameraFocus.p)
end
end
the only problem is i dont know how to figure out the which direction that player is moving if you help me that then i think i would be able to do it
i wanna somehow detect if the player is turning camera right left top or down
If you read through the article of this function, in the code example, it shows that you can record the player’s previous touch position, and their new touch position. Try using that.
hey seems like im having a problem here so basically whenever im moving my thumb to move player around i dont want the camera to move but idk how to fix i tried putting if not gpe then but still having the problem
Really depends on what you set the default cameras mode to. If you set it to scriptable, then yes, they wouldn’t be able to move the camera while walking (if you code it that way).