Right thumbstick (Rz) drift - camera moves on its own
Hello, I've encountered quite common problem where camera wildly rotates on its own when joystick/gamepad is plugged while trying to make camera controllable with it. The problem seem to touch only right stick's left-right axis (Rz) and not any other.
The analog stick in question works fine in non-unity applications, such as emulators, so it is definitely not a hardware issue. Any suggestions how to fix it? The goal is for the player to be able to just use gamepad without any previous configuration, left stick for movement, right for the camera.
Answer by SgtGhostHeart · Jan 19, 2017 at 04:47 PM
Set dead zone to 1 or to size that will work for you on your project, keep making it go up until it stops moving.
Answer by PLANET-HEAD · Feb 16, 2016 at 04:00 PM
I'm doing the same thing and getting this exact same problem as well... All other axes are working just fine.
I seem to have fixed this issue my end. I was adjusting the sensitivity on the input end rather than in the inspector for the FPScontroller. Setting the input sensitivity to 1 or below fixed it and then in the First Person Controller script under $$anonymous$$ouse Look I could edit the actual sensitivity there. Hope this solves it for you :)
Answer by 686InSomNia686 · Feb 21, 2017 at 10:08 AM
Hi, I have modified the MouseLook.cs script from the FPSController to cut the parasite positions. When the joystick is static, I force the rotation to Zero. Add that to the script after the line 33-34 :
float yRot = CrossPlatformInputManager.GetAxis("Mouse X") * XSensitivity;
float xRot = CrossPlatformInputManager.GetAxis("Mouse Y") * YSensitivity;
//Smooth static position of the View Joystick
if (Mathf.Abs(yRot) < 0.1f)
{
if (Mathf.Abs(xRot) < 0.1f)
{
yRot = 0.0f;
xRot = 0.0f;
}
}
Best Regards, Clément
Your answer
Follow this Question
Related Questions
Trying to make my camera rotate using gamepad 0 Answers
Recognize when ever camera looks up and turns back down 0 Answers
Smooth Look at... 2 Answers
Mouse Look Script Not Working 1 Answer