Example #1
0
    private vrValue VirtualHandGogoButtonHandler(vrValue iValue)
    {
        // Activate Gogo Virtual Hand
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionVirtualHandGogo");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Virtual Hand Gogo activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Virtual Hand Gogo deactivated.");
        }

        return null;
    }
Example #2
0
    private vrValue NavigationJoystickHandler(vrValue iValue)
    {
        // Activate Joystick Navigation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationWandJoystick");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Navigation Joystick activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Navigation Joystick deactivated.");
        }

        return null;
    }
Example #3
0
    private vrValue ManipulationHomerHandler(vrValue iValue)
    {
        // Activate Homer Manipulation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationHomer");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Manipulation Homer activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Manipulation Homer deactivated.");
        }

        return null;
    }
Example #4
0
    private vrValue NavigationGrabWorldHandler(vrValue iValue)
    {
        // Activate Grab World Navigation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationGrabWorld");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Navigation Grab World activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Navigation Grab World deactivated.");
        }

        return null;
    }
Example #5
0
    private vrValue NavigationElasticHandler(vrValue iValue)
    {
        // Activate Elastic Navigation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationElastic");

        bool activate = iValue.GetBool();

        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Navigation Elastic activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Navigation Elastic deactivated.");
        }

        return(null);
    }
Example #6
0
 private vrValue ReturnObjectsCheckboxHandler(vrValue iValue)
 {
     m_VRManager.ManipulationReturnObjects = iValue.GetBool();
     MVRTools.Log("[ ] Manipulation return objects: " + iValue.GetBool().ToString());
     return null;
 }
Example #7
0
 private vrValue ProxiWarningCheckboxHandler(vrValue iValue)
 {
     m_VRManager.ShowScreenProximityWarnings = iValue.GetBool();
     MVRTools.Log("[ ] Show proximity warnings: " + iValue.GetBool().ToString());
     return null;
 }
Example #8
0
    private vrValue NavigationJoystickHandler(vrValue iValue)
    {
        // Activate Joystick Navigation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationWandJoystick");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Navigation Joystick activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Navigation Joystick deactivated.");
        }

        return null;
    }
Example #9
0
 private vrValue CollisionsCheckboxHandler(vrValue iValue)
 {
     m_VRManager.NavigationCollisions = iValue.GetBool();
     MVRTools.Log("[ ] Navigation Collisions: " + iValue.GetBool().ToString());
     return(null);
 }
Example #10
0
 private vrValue FramerateCheckboxHandler(vrValue iValue)
 {
     m_VRManager.ShowFPS = iValue.GetBool();
     MVRTools.Log("[ ] Show Frame Rate: " + iValue.GetBool().ToString());
     return(null);
 }
Example #11
0
 private vrValue CollisionsCheckboxHandler(vrValue iValue)
 {
     m_VRManager.NavigationCollisions = iValue.GetBool();
     MVRTools.Log("[ ] Navigation Collisions: " + iValue.GetBool().ToString());
     return null;
 }
Example #12
0
 private vrValue CheckboxHandler(vrValue iValue)
 {
     print("Checkbox value : " + iValue.GetBool().ToString());
     return null;
 }
Example #13
0
 private vrValue EnabledCommandHandler(vrValue enable)
 {
     Enabled = enable.GetBool();
     return true;
 }
Example #14
0
 private vrValue EnabledCommandHandler(vrValue enable)
 {
     Enabled = enable.GetBool();
     return(true);
 }
Example #15
0
    private vrValue VirtualHandGogoButtonHandler(vrValue iValue)
    {
        // Activate Gogo Virtual Hand
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionVirtualHandGogo");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Virtual Hand Gogo activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Virtual Hand Gogo deactivated.");
        }

        return null;
    }
Example #16
0
 private vrValue FlyCheckboxHandler(vrValue iValue)
 {
     m_VRManager.Fly = iValue.GetBool();
     MVRTools.Log("[ ] Fly mode: " + iValue.GetBool().ToString());
     return null;
 }
    protected void Update()
    {
        var deviceMgr = MiddleVR.VRDeviceMgr;

        if (deviceMgr != null)
        {
            var headTracker   = deviceMgr.GetTracker("zSpace.Head.Tracker");
            var stylusTracker = deviceMgr.GetTracker("zSpace.Stylus.Tracker");

            if (headTracker == null || stylusTracker == null)
            {
                MiddleVRTools.Log(0, "[X] No head or stylus tracker found for zSpace. Did you load the driver?");
                enabled = false;
                return;
            }

            bool headTargetIsVisible = headTracker.IsTracked();
            if (headTargetWasVisible != headTargetIsVisible)
            {
                MiddleVRTools.Log(2, "[+] Head is " + (headTargetIsVisible ? "visible" : "invisible") +
                                  " by the zSpace device.");

                headTargetWasVisible = headTargetIsVisible;
            }

            bool stylusTargetIsVisible = stylusTracker.IsTracked();
            if (stylusTargetWasVisible != stylusTargetIsVisible)
            {
                MiddleVRTools.Log(2, "[+] Stylus is " + (stylusTargetIsVisible ? "visible" : "invisible") +
                                  " by the zSpace device.");

                stylusTargetWasVisible = stylusTargetIsVisible;
            }
        }

        var kernel = MiddleVR.VRKernel;

        if (kernel != null && deviceMgr != null)
        {
            if (deviceMgr.IsKeyToggled(MiddleVR.VRK_C))
            {
                Color c = m_UsingLEDColor0 ? m_LEDColor0 : m_LEDColor1;

                vrVec3 proposedColor = new vrVec3(c.r, c.g, c.b);

                MiddleVRTools.Log(2, "[+] Proposed stylus LED color sent to zSpace: ("
                                  + proposedColor.x() + ", " + proposedColor.y() + ", " + proposedColor.z() + ").");

                kernel.ExecuteCommand(
                    "zSpace.SetStylusLEDColor", proposedColor);

                m_UsingLEDColor0 = !m_UsingLEDColor0;

                vrVec3 usedColorAsRGB = GetStylusLEDColor();

                MiddleVRTools.Log(2, "[+] Current zSpace stylus LED color is: ("
                                  + usedColorAsRGB.x() + ", " + usedColorAsRGB.y() + ", " + usedColorAsRGB.z() + ").");
            }

            if (deviceMgr.IsKeyToggled(MiddleVR.VRK_L))
            {
                bool turnOnLight = true;

                if (deviceMgr.IsKeyPressed(MiddleVR.VRK_LSHIFT) || deviceMgr.IsKeyPressed(MiddleVR.VRK_RSHIFT))
                {
                    turnOnLight = false;
                }

                MiddleVRTools.Log(2, "[+] Trying to turn " +
                                  (turnOnLight ? "on" : "off") + " the zSpace stylus LED.");

                kernel.ExecuteCommand(
                    "zSpace.SetStylusLEDAsTurnedOn", turnOnLight);

                vrValue isLEDTurnedOnValue = kernel.ExecuteCommand(
                    "zSpace.IsStylusLEDTurnedOn", null);

                bool isLEDTurnedOn = isLEDTurnedOnValue.GetBool();

                MiddleVRTools.Log(2, "[+] zSpace stylus LED turned on? " +
                                  (isLEDTurnedOn ? "Yes" : "No") + ".");

                if (isLEDTurnedOn)
                {
                    vrVec3 usedColorAsRGB = GetStylusLEDColor();

                    MiddleVRTools.Log(2, "[+] Current zSpace stylus LED color is: ("
                                      + usedColorAsRGB.x() + ", " + usedColorAsRGB.y() + ", " + usedColorAsRGB.z() + "). If set to black, no light will appear!");
                }
            }

            if (deviceMgr.IsKeyToggled(MiddleVR.VRK_V))
            {
                if (deviceMgr.IsKeyPressed(MiddleVR.VRK_LSHIFT) || deviceMgr.IsKeyPressed(MiddleVR.VRK_RSHIFT))
                {
                    // Stop vibration (nothing will happen if the stylus
                    // is not vibrating).

                    MiddleVRTools.Log(2, "[+] Trying to stop zSpace stylus vibration.");

                    kernel.ExecuteCommand(
                        "zSpace.StopStylusVibration", null);
                }
                else
                {
                    // Start vibration.

                    MiddleVRTools.Log(2, "[+] Trying to start zSpace stylus vibration with parameters:\n" +
                                      "- duration vibration: " + m_DurationVibration + " s,\n" +
                                      "- duration between two vibrations: " + m_DurationBetween + " s,\n" +
                                      "- number of vibrations: " + m_NumberOfVibrations + ".");

                    vrValue vibrationValueList = vrValue.CreateList();
                    vibrationValueList.AddListItem(m_DurationVibration);
                    vibrationValueList.AddListItem(m_DurationBetween);
                    vibrationValueList.AddListItem(m_NumberOfVibrations);
                    // It is also possible to set the intensity of the vibration:
                    // pass then a 4th argument with a float between 0.0 and 1.0.
                    //vibrationValueList.AddListItem(1.0f);

                    kernel.ExecuteCommand(
                        "zSpace.StartStylusVibration", vibrationValueList);
                }
            }

            if (deviceMgr.IsKeyToggled(MiddleVR.VRK_T))
            {
                MiddleVRTools.Log(2, "[+] Trying to trigger a default zSpace stylus vibration.");

                kernel.ExecuteCommand(
                    "zSpace.TriggerDefaultStylusVibration",
                    true);  // or false to stop the vibration (if any).
            }
        }
    }
Example #18
0
 private vrValue FramerateCheckboxHandler(vrValue iValue)
 {
     m_VRManager.ShowFPS = iValue.GetBool();
     MVRTools.Log("[ ] Show Frame Rate: " + iValue.GetBool().ToString());
     return null;
 }
Example #19
0
 private vrValue ProxiWarningCheckboxHandler(vrValue iValue)
 {
     m_VRManager.ShowScreenProximityWarnings = iValue.GetBool();
     MVRTools.Log("[ ] Show proximity warnings: " + iValue.GetBool().ToString());
     return(null);
 }
Example #20
0
    private vrValue ManipulationRayHandler(vrValue iValue)
    {
        // Activate Ray Manipulation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionManipulationRay");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Manipulation Ray activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Manipulation Ray deactivated.");
        }

        return null;
    }
Example #21
0
 private vrValue FlyCheckboxHandler(vrValue iValue)
 {
     m_VRManager.Fly = iValue.GetBool();
     MVRTools.Log("[ ] Fly mode: " + iValue.GetBool().ToString());
     return(null);
 }
Example #22
0
    private vrValue NavigationGrabWorldHandler(vrValue iValue)
    {
        // Activate Grab World Navigation
        vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteraction("InteractionNavigationGrabWorld");

        bool activate = iValue.GetBool();
        if (activate)
        {
            MiddleVR.VRInteractionMgr.Activate(interaction);
            MVRTools.Log("[ ] Navigation Grab World activated.");
        }
        else
        {
            MiddleVR.VRInteractionMgr.Deactivate(interaction);
            MVRTools.Log("[ ] Navigation Grab World deactivated.");
        }

        return null;
    }
Example #23
0
 private vrValue ReturnObjectsCheckboxHandler(vrValue iValue)
 {
     m_VRManager.ManipulationReturnObjects = iValue.GetBool();
     MVRTools.Log("[ ] Manipulation return objects: " + iValue.GetBool().ToString());
     return(null);
 }
 private vrValue CheckboxHandler(vrValue iValue)
 {
     print("Checkbox value : " + iValue.GetBool().ToString());
     return(null);
 }