Hello! I need some help. I have scripted a working camera movement that only really works for PC. I’m not sending the whole code, but here’s partial code that basically controls the camera movement. I even tried commenting it out and I know it’s definitely this code. When I commented it out, I couldn’t move my camera on PC. I want to achieve where it works for mobile too. On mobile, the camera can’t move and I want this script compatible with mobile too. Here’s the script. If anyone who’s experienced with this could help me, that’d be awesome! Thanks.
This is partial of the whole main code. But the other code really just controls other stuff like movement speed and stuff. The code I sent is what controls the camera movement. How can I make it support mobile movement too?
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0
input.InputChanged:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovemen then
local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness
local X = TargetAngleX - delta.y
TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X
TargetAngleY = (TargetAngleY - delta.x) %360
end
end)