Ejemplo n.º 1
0
    public void Awake()
    {
        rotationFilter = new KalmanFilteredRotation();
        rotationFilter.skipIdenticalMeasurements = true;
        rotationFilter.rotationNoiseCovariance   = rotationNoiseCovariance;

        bodyTrackingDeviceID = (int)bodyTrackingDevice;
        RUISGestureRecognizer[] gestureRecognizerScripts = GetComponents <RUISGestureRecognizer>();

        foreach (RUISGestureRecognizer script in gestureRecognizerScripts)
        {
            if (script.ToString() != gestureSelectionScriptName)
            {
                script.enabled = false;
            }
            else
            {
                gestureRecognizer = script;
            }
        }

        if (!skeletonManager)
        {
            skeletonManager = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager;
        }

        selectionVisualizers = new Texture2D[8];
        for (int i = 0; i < amountOfSelectionVisualizerImages; i++)
        {
            selectionVisualizers[i] = Resources.Load("RUIS/Graphics/Selection/visualizer" + (i + 1)) as Texture2D;
        }

        displayManager = FindObjectOfType(typeof(RUISDisplayManager)) as RUISDisplayManager;

        if (!gestureRecognizer)
        {
            Debug.LogWarning(typeof(RUISGestureRecognizer) + " component was not found for wand '" + name + "'."
                             + "Add it if you want to use gesture-based selection.");
        }

        wandSelector = GetComponent <RUISWandSelector>();
        if (!wandSelector)
        {
            Debug.LogError(typeof(RUISWandSelector) + " component was not found for wand '" + name + "'."
                           + "Add it if you want to use gesture-based selection. Disabling wand.");
            this.enabled = false;
        }

        PlayerLost();
    }
Ejemplo n.º 2
0
    public void Awake()
    {
        rotationFilter = new KalmanFilteredRotation();
        rotationFilter.skipIdenticalMeasurements = true;
        rotationFilter.rotationNoiseCovariance = rotationNoiseCovariance;

        bodyTrackingDeviceID = (int)bodyTrackingDevice;
        RUISGestureRecognizer[] gestureRecognizerScripts = GetComponents<RUISGestureRecognizer>();

        foreach(RUISGestureRecognizer script in gestureRecognizerScripts)
        {
            if(script.ToString() != gestureSelectionScriptName)
                script.enabled = false;
            else
                gestureRecognizer = script;
        }

        if (!skeletonManager)
        {
            skeletonManager = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager;
        }

        selectionVisualizers = new Texture2D[8];
        for (int i = 0; i < amountOfSelectionVisualizerImages; i++)
        {
            selectionVisualizers[i] = Resources.Load("RUIS/Graphics/Selection/visualizer" + (i + 1)) as Texture2D;
        }

        displayManager = FindObjectOfType(typeof(RUISDisplayManager)) as RUISDisplayManager;

        if (!gestureRecognizer)
        {
            Debug.LogWarning(  typeof(RUISGestureRecognizer) + " component was not found for wand '" + name + "'."
                             + "Add it if you want to use gesture-based selection.");
        }

        wandSelector = GetComponent<RUISWandSelector>();
        if(!wandSelector)
        {
            Debug.LogError(  typeof(RUISWandSelector) + " component was not found for wand '" + name + "'."
                           + "Add it if you want to use gesture-based selection. Disabling wand.");
            this.enabled = false;
        }

        PlayerLost();
    }