alt textI’ve created a simple multiplayer game and now I’m trying to set up my two gamepads.
This is how my input manager looks like:
Axes
- Name: Horizontal_P1
- Type: Joystick
- Axis: X axis
- JoyNum: Joistick 1
-
- Name: Vertical_P1
- Type: Joystick Axis
- Axis: Y axis
- JoyNum: Joistick 1
-
- Name: Horizontal_P2
- Type: Joystick Axis
- Axis: X axis
- JoyNum: Joistick 2
-
- Name: Vertical_P2
- Type: Joystick Axis
- Axis: Y axis
- JoyNum: Joistick 2
Here’s a bit of my code from the Player_1 script:
void FixedUpdate()
{
float _moveHorizontal = Input.GetAxis ("Horizontal_P1");
float _moveVertical = Input.GetAxis ("Vertical_P1");
Vector3 _movement = new Vector3(_moveHorizontal, 0.0f, _moveVertical);
rigidbody.AddForce (_movement * _movementSpeed, ForceMode.Force);
}
All the player gameObjects have a similar script attached.
And here come the problems:
- only one gameObject(Player_1) moves.
- ONLY on the x axis (only left and
right).
Please help.