- Home /
Duplicate Question
Joystick isn't responding?
I have this java code: #pragma strict
var speed = 65.0; // Degrees per second
function Update() {
var h = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
var v = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Rotate(v,h,0);
}
The purpose of which is to rotate plane left or right if the joystick is moved right or left, and to rotate it upwards and backwards if the joystick is moved up or down. Like this:
The problem is that my variables aren't changing(plane moves in a straight line), but I can move the joystick on the phone emulator(BlueStack). So what can be causing the error? P.S. I've changed Input, so it uses joystick. And I have set the script as a component of my Plane Model. Please, help!
Please don't open a new question that is the same as your existing question.
http://answers.unity3d.com/questions/657900/joystick-script-problem.html
It is critical for anyone attempting to answer your question to know that you are using a virtual joystick (Unity single joystick prefab). The code above is just about worthless for a joystick prefab. As I mentioned in my comments in the other question, you will need to get access to the Joystick script attached to the Joystick prefab and use the joystick position in controlling your rotation.