TrackingControllerMotion

public void TrackingControllerMotion(bool value);

Description


using UnityEngine;
using Volplane;

public class Demo : VolplaneBehaviour
{
    public int playerId = 0;            // Player identifier
    public float trackingTime = 5f;     // How long should the controller motion be tracked

    private float time = 0f;            // Time variable
    private bool isTracking = false;    // Flag

    // Start receiving accelerometer and gyroscope input
    public void StartTracking()
    {
        // Start tracking controller motion
        GetPlayer(playerId).TrackingControllerMotion(true);
        time = 0f;
        isTracking = true;
    }

    // Will be called every frame
    void Update()
    {
        if(isTracking)
        {
            if(time >= trackingTime)
            {
                // Stop receiving motion data
                GetPlayer(playerId).TrackingControllerMotion(false);
                isTracking = false;
            }
            else
            {
                time += Time.deltaTime;
            }
        }
    }
}

Will tell the players controller to start tracking device motion (accelerometer and gyroscope). For better processing performance, the Volplane framework will not receive motion input from the controllers unless explicitly stated.

 

Motion input can be handled by using the methods from the VInput class.

value Boolean indicating the state, tracking (true) or not tracking (false).