-
What do you want to achieve?
I am trying to make a Camera Mode that supports Gamepads / Controllers. The mode part is working well, but I am having difficulty making a camera system that resembles how controller cameras typically work. -
What is the issue? Include screenshots / videos if possible!
This is the video of the issue, the issue is that if I ‘hit’ the thumbstick in increments, I am able to move to where I want it to be, however I want it so that you can hold the thumbstick in a given direction and it will continually move in that direction. (as controllers camera’s typically work)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I searched to see if there were any solutions to making a controller camera, I couldn’t find anything.
The solution i’ve tried so far is to refactor my camera’s update function (renderstepped connection) to multiply the current orientation alongside all the other subjects, which results in an unstoppable, infinite turning loop, which is not desired.
This is the code that is used in the video. It is the two important functions inside the table for my ‘controller mode’. I can show more if needed, but to not convolute this i’ve left unecessary things out.
Update = function()
Camera.CFrame = (CameraAngle * CameraOffset) + CameraSubject.Position
Camera.Focus = Camera.CFrame
end,
Input = function(_, _, Thumbstick)
Thumbstick = Thumbstick.Position * 0.05
Pan -= Thumbstick.X
Tilt += Thumbstick.Y
CameraAngle = CFrame.fromOrientation(Tilt, Pan, 0)
end
The Input function is called via ContextActionService, binded to Thumbstick2
. The ‘pan’ and ‘tilt’ variables act as increments for the new camera angle.
And then on the Update function (again called on RenderStepped) applies the change to the CameraAngle and positions itself based on the camera subject and the cameraoffset
Any help is appreciated