Difficulty making 'Gamepad' camera turning

  1. 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.

  2. 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)

  1. 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 :slight_smile:

1 Like

Shouldn’t it be

Pan = Thumbstick.x
Tilt = Thumbstick.Y

Because you’re getting the thumbstick position and not velocity?

2 Likes

Does this fire every time the thumbstick position changes, as in every time there’s even a tiny movement on it? Otherwise you won’t be able to get smooth camera movement using this approach.

Could you post the entire script? That would make it a bit easier to see which things are called when.

1 Like