- Home /
Question by
Corinator3000 · Nov 05, 2014 at 09:53 PM ·
controllerjoystickgetaxiswasdarrow-keys
Use only one control scheme for Input.GetAxis
I am using Input.GetAxis for a character controller, and this is the movement script (C#).
using UnityEngine;
using System.Collections;
public class CubeMove : MonoBehaviour {
public float speed = 500;
void FixedUpdate () {
Vector3 movement = new Vector3 (Input.GetAxis ("Horizontal"), 0.0f, Input.GetAxis ("Vertical"));
rigidbody.AddForce (movement * speed * Time.deltaTime);
}
}
This script works fine, but I wanted to add another player to control separately, and the GetAxis statement uses all three control schemes (WSAD, Arrow Keys, Gamepad Joystick) as input. How can I make the GetAxis function only use one control scheme as input?
Comment
Best Answer
Answer by AlwaysSunny · Nov 05, 2014 at 09:38 PM
If I understand correctly, just edit your project Input settings. Remove whichever keys/joysticks you want to make into separate axes from their respective default axes. Create new axes and add the keys/joysticks to the newly created axes.