The code I’m using came from a devforum post I saw on how to make polygun’s styled camera but just modified to fit controllers.
So right now, I’m currently trying to make the thumbstick on the controllers move the custom camera which is just an overhead 3rd person view locked with the character. The issue is that when using the controller’s thumbstick to move the camera, when moving the thumbstick back, it goes back into where it was before.
So I tried modifying the camera script and found the issue, it was the Cam’s cframe being set. However, not set
I might be completely missing something but I dont know what
(Click the links)
Intended Behavior:
When setting cframe on camera (Rubberbanding):
Removing CFrame on Camera (Unintended, A mix of rubberbanding charcter and intended behavior yet unintended):
-- Controls Camera
local UserInput = game:GetService("UserInputService")
UserInput.InputChanged:Connect(function(Input,Processed)
if Input.UserInputType == Enum.UserInputType.Gamepad1 then
if Input.KeyCode == Enum.KeyCode.Thumbstick2 then
FollowMouse = 0
X = X + Input.Delta.X
Y = math.clamp(Y-(Input.Delta.Y), -1, 1)
end
end
end)
-- Rotates Character
RunService:BindToRenderStep("CameraUpdate", Enum.RenderPriority.Camera.Value, function(Delta)
UserInput.MouseBehavior = Enum.MouseBehavior.LockCenter
local CameraRotation = CFrame.new(RootPart.Position) * CFrame.Angles(0, -X, 0) * CFrame.Angles(Y, 0, 0)
Cam.CFrame = CameraRotation * CFrame.new(0, 4, 9) -- The issue
if FollowMouse <= .3 then
RootPart.CFrame = RootPart.CFrame:Lerp(CFrame.new(RootPart.CFrame.p) * CFrame.fromEulerAnglesXYZ(0, -X, 0), 0.55) -- Probable fix here?
end
FollowMouse = math.clamp(FollowMouse + Delta, 0, 1)
end)