GetSwipeAngle

public static float GetSwipeAngle(int playerId, string elementName, bool align = false);
public static float GetSwipeAngle(VPlayer player, string elementName, bool align = false);

Description

using UnityEngine;
using Volplane;

public class Demo : VolplaneBehaviour
{
    public int playerId;

    void Update()
    {
        // Check for triggered swipe field
        if(VInput.GetInput(playerId, "swipe-field"))
        {
            float angle = GetSwipeAngle(playerId, elementName, true);

            // Rotate to match swipe angle
            transform.rotation = Quaternion.Euler(0f, angle * Mathf.Rad2Deg, 0f);
        }
    }
}

Returns the calculated angle in radians of a triggered swipe field. This method only returns valid data when used with an analog swipe field.

 

playerId The player identifier.
player A player object.
elementName The name identifier of the input element set in the controller editor.
align Align the calculated angle to the global up vector (an angle of 0 will point upwards).