OnJoystick

Description

using UnityEngine;
using Volplane;

public class Demo : VolplaneBehaviour
{
    void OnJoystick(int playerId, string elementName, Vector2 axis)
    {
        Vector3 fromJoystick = new Vector3(axis.x, 0f, axis.y);

        Debug.LogFormat(
            "Player {0:D} uses joystick '{1:G}'.",
            playerId,
            elementName
        );

        // Move object
        transform.Translate(fromJoystick * Time.deltaTime);
    }
}

Gets called when a joystick input on a players controller is registered. See VInput for a more common input handling.

 

playerId The player identifier.
elementName The name identifier of the registered joystick element.
axis The axis coordinates representing the joystick.