GetCoordinates

public static Vector2 GetCoordinates(int playerId, string elementName);
public static Vector2 GetCoordinates(VPlayer player, string elementName);

Description

using UnityEngine;
using Volplane;

public class Demo : VolplaneBehaviour
{
    public int playerId;
    public Vector2 areaSize;

    void Update()
    {
        // Move transform to position where player touched
        Vector2 touchInput = VInput.GetCoordinates(playerId, "touch-area");
        Vector3 position = new Vector3(
                            touchInput.x * areaSize.x,
                            0f,
                            touchInput.y * areaSize.y);

        transform.position = position;
    }
}

Returns 2D coordinates indicating where on the touch area an input has been registered. This method is intended to be used for touch areas, but also works with d-pad and joystick input elements. The vector values will be in the range 0 to 1 for touch areas.

 

playerId The player identifier.
player A player object.
elementName The name identifier of the input element set in the controller editor.