- Home /
Question by
HyblockerDevelopment · Aug 28, 2017 at 07:44 AM ·
c#inputmanagerinput.getaxisjoysticks
Joystick Returning 0 In Axis
So i'm trying to make a game that requires DUALSHOCK 3 Input (though I might move to DUALSHOCK 4). I'm trying to get input from the RIGHT ANALOG STICK, but it's returning 0. Even when I move the ANALOG STICK!
Please help me! Below is my Code (Right now I'm trying to move the camera)
using UnityEngine;
using System.Collections;
using System;
public class CamMovement : MonoBehaviour {
public GameObject Cam;
public GameObject FollowObj;
public static bool FollowPlr=true;
public static bool FixedRotation=false;
public static Quaternion Rot=Quaternion.Euler(new Vector3(0,0,0));
// Use this for initialization
void Start () {
Cam.transform.position=FollowObj.transform.position+new Vector3(0,0,-10);
}
// Update is called once per frame
void Update () {
if (FollowPlr==true && Shake!=0){
Cam.transform.position=FollowObj.transform.position+new Vector3(0,0,-10);
}
if (FixedRotation == true) {
Cam.transform.rotation = Rot;
} else {
//Listen to gamepad output
float RX = Input.GetAxis ("RX");
float RY = Input.GetAxis ("RY");
print ("RX=" + RX.ToString ());
print ("RY=" + RY.ToString ());
float CURR_X = 0f;
float CURR_Y = 0f;
if(-30<CURR_X && CURR_X>30){
CURR_X = CURR_X + (RX);
}
if(-30<CURR_Y && CURR_Y>30){
CURR_Y = CURR_Y + (RY);
}
//Make Rotation value
//Rot = Quaternion.Euler(new Vector3(0,CURR_Y,CURR_X));
//Set Rotation
Cam.transform.Rotate(0,CURR_Y,CURR_X);
}
}
And here's my Input Manager:
inputmanager4dualshock3.png
(61.2 kB)
Comment
Answer by this-play · Aug 28, 2017 at 11:53 AM
maybe something off with the smoothing values (dead, sentitivity, gravity?) try Input.GetAxisRaw() and check your joystick axis mapping.