protected void Start()
    {
        // Make sure the base interaction is started
        InitializeBaseInteraction();

        m_it = new vrInteractionNavigationWandJoystick(Name);
        // Must tell base class about our interaction
        SetInteraction(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_DirectionReferenceNode = MiddleVR.VRDisplayMgr.GetNode(DirectionReferenceNode);
        m_TurnAroundNode         = MiddleVR.VRDisplayMgr.GetNode(TurnAroundNode);

        if (m_DirectionReferenceNode != null && m_TurnAroundNode != null)
        {
            m_it.SetDirectionReferenceNode(m_DirectionReferenceNode);
            m_it.SetTurnAroundNode(m_TurnAroundNode);
            m_it.SetTranslationSpeed(TranslationSpeed);
            m_it.SetRotationSpeed(RotationSpeed);
            m_it.SetFly(Fly);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationWandJoystick: One or several nodes are missing.");
        }
    }
Exemplo n.º 2
0
    protected void Start()
    {
        // Make sure the base interaction is started
        InitializeBaseInteraction();

        m_it = new vrInteractionVirtualHandGogo(Name);
        // Must tell base class about our interaction
        SetInteraction(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        vrNode3D handNode = MiddleVR.VRDisplayMgr.GetNode(HandNode);
        vrNode3D headNode = MiddleVR.VRDisplayMgr.GetNode(HeadNode);

        if (handNode != null && headNode != null)
        {
            m_it.SetHandNode(handNode);
            m_it.SetHeadNode(headNode);
            m_it.SetGogoStartDistance(GogoStartDistance);
            m_it.SetRealDistanceMax(RealDistanceMax);
            m_it.SetVirtualDistanceMax(VirtualDistanceMax);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionVirtualHandGogo: One or several nodes are missing.");
        }
    }
Exemplo n.º 3
0
 void Start()
 {
     if (ElasticRoot == null || Elastic == null)
     {
         MiddleVR.VRLog(2, "[X] VRElasticRepresentation error: bad ElasticRoot or Elastic GameObject reference");
     }
 }
    // Use this for initialization
    void Start()
    {
        m_it = new vrInteractionNavigationElastic(Name);
        GC.SuppressFinalize(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_ReferenceNode  = MiddleVR.VRDisplayMgr.GetNode(ReferenceNode);
        m_NavigationNode = MiddleVR.VRDisplayMgr.GetNode(NavigationNode);
        m_TurnAroundNode = MiddleVR.VRDisplayMgr.GetNode(TurnAroundNode);

        if (m_ReferenceNode != null && m_NavigationNode != null && m_TurnAroundNode != null)
        {
            m_it.SetActionButton(WandActionButton);

            m_it.SetReferenceNode(m_ReferenceNode);
            m_it.SetNavigationNode(m_NavigationNode);
            m_it.SetTurnAroundNode(m_TurnAroundNode);

            m_it.SetTranslationSpeed(TranslationSpeed);
            m_it.SetRotationSpeed(RotationSpeed);

            m_it.SetDistanceThreshold(DistanceThreshold);
            m_it.SetAngleThreshold(AngleThreshold);

            m_it.SetUseRotationYaw(UseRotationYaw);

            m_it.SetFly(Fly);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationElastic: One or several nodes are missing.");
        }
    }
    protected void Start()
    {
        // Make sure the base interaction is started
        InitializeBaseInteraction();

        m_it = new vrInteractionManipulationRay(Name);
        // Must tell base class about our interaction
        SetInteraction(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_HandNode = MiddleVR.VRDisplayMgr.GetNode(HandNode);

        if (m_HandNode != null)
        {
            m_it.SetGrabWandButton(WandGrabButton);
            m_it.SetManipulatorNode(m_HandNode);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionManipulationRay: One or several nodes are missing.");
        }

        m_Wand = this.GetComponent <VRWand>();
    }
    // Use this for initialization
    void Start()
    {
        m_it = new vrInteractionNavigationWandJoystick(Name);
        GC.SuppressFinalize(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_DirectionReferenceNode = MiddleVR.VRDisplayMgr.GetNode(DirectionReferenceNode);
        m_NavigationNode         = MiddleVR.VRDisplayMgr.GetNode(NavigationNode);
        m_TurnAroundNode         = MiddleVR.VRDisplayMgr.GetNode(TurnAroundNode);

        if (m_DirectionReferenceNode != null && m_NavigationNode != null && m_TurnAroundNode != null)
        {
            m_it.SetDirectionReferenceNode(m_DirectionReferenceNode);
            m_it.SetNavigationNode(m_NavigationNode);
            m_it.SetTurnAroundNode(m_TurnAroundNode);
            m_it.SetTranslationSpeed(TranslationSpeed);
            m_it.SetFly(Fly);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationWandJoystick: One or several nodes are missing.");
        }
    }
    private void Start()
    {
        // Make sure the base interaction is started
        InitializeBaseInteraction();

        m_VRMgr = GameObject.Find("VRManager").GetComponent <VRManagerScript>();

        m_it = new vrInteractionManipulationHomer(Name);
        // Must tell base class about our interaction
        SetInteraction(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_HandNode = MiddleVR.VRDisplayMgr.GetNode(HandNode);

        if (m_HandNode != null)
        {
            m_it.SetGrabWandButton(WandGrabButton);
            m_it.SetTranslationScale(TranslationScale);
            m_it.SetRotationScale(RotationScale);
            m_it.SetManipulatorNode(m_HandNode);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionManipulationHomer: One or several nodes are missing.");
        }

        m_Wand = this.GetComponent <VRWand>();
    }
Exemplo n.º 8
0
    /*
     * protected void Update()
     * {
     *  // Nothing to do for this interaction, everything is done in the kernel
     * }
     */

    protected void OnEnable()
    {
        MiddleVR.VRLog(3, "[ ] VRInteractionVirtualHandGogo: enabled");
        if (m_it != null)
        {
            MiddleVR.VRInteractionMgr.Activate(m_it);
        }
    }
 protected void OnEnable()
 {
     MiddleVR.VRLog(3, "[ ] VRInteractionNavigationGrabWorld: enabled");
     if (m_it != null)
     {
         MiddleVR.VRInteractionMgr.Activate(m_it);
     }
 }
 protected void OnDisable()
 {
     MiddleVR.VRLog(3, "[ ] VRInteractionNavigationWandJoystick: disabled");
     if (m_it != null && MiddleVR.VRInteractionMgr != null)
     {
         MiddleVR.VRInteractionMgr.Deactivate(m_it);
     }
 }
 void OnDisable()
 {
     MiddleVR.VRLog(3, "[ ] VRInteractionNavigationElastic: disabled");
     if (m_it != null && MiddleVR.VRInteractionMgr != null)
     {
         MiddleVR.VRInteractionMgr.Deactivate(m_it);
     }
 }
 void OnEnable()
 {
     MiddleVR.VRLog(3, "[ ] VRInteractionNavigationElastic: enabled");
     if (m_it != null)
     {
         MiddleVR.VRInteractionMgr.Activate(m_it);
     }
 }
 protected void OnEnable()
 {
     MiddleVR.VRLog(3, "[ ] VRInteractionManipulationRay: enabled");
     if (m_it != null)
     {
         MiddleVR.VRInteractionMgr.Activate(m_it);
     }
 }
    protected void OnDisable()
    {
        MiddleVR.VRLog(3, "[ ] VRInteractionManipulationRay: disabled");

        if (m_it != null && MiddleVR.VRInteractionMgr != null)
        {
            MiddleVR.VRInteractionMgr.Deactivate(m_it);
        }
    }
Exemplo n.º 15
0
    protected void OnDisable()
    {
        MiddleVR.VRLog(3, "[ ] VRInteractionVirtualHandGogo: disabled");

        if (m_it != null && MiddleVR.VRInteractionMgr != null)
        {
            MiddleVR.VRInteractionMgr.Deactivate(m_it);
        }
    }
    void OnDisable()
    {
        MiddleVR.VRLog(3, "[ ] VRInteractionManipulationReturnObjects: disabled");

        // Reset all objects and release them
        foreach (ReturningObject returningObject in m_ReturningObjects)
        {
            _ResetObjectProperties(returningObject);
        }

        m_ReturningObjects.Clear();
    }
    void UpdateElasticRepresentation()
    {
        if (m_ElasticRepresentation == null)
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationElastic error: bad elastic representation reference");
            return;
        }

        Vector3 startPosition = MVRTools.ToUnity(m_it.GetInteractionStartWorldMatrix().GetTranslation());
        Vector3 endPosition   = MVRTools.ToUnity(m_ReferenceNode.GetPositionWorld());

        m_ElasticRepresentation.SetElasticPoints(startPosition, endPosition);
    }
Exemplo n.º 18
0
    private IEnumerator LaunchWebRTCServer()
    {
        MiddleVR.VRLog(1, "[>] Starting copy of the WebRTC server.");

        // We currently have to copy the WebRTC server in %appdata%/MiddleVR
        // due to Windows not allowing a process to start an other process
        // from "Program Files" without admin right.
        var copyingServerThread = new Thread(CopyWebRTCServer);

        copyingServerThread.Start();

        while (!m_ServerReady)
        {
            yield return(null);
        }

        copyingServerThread.Join();

        MiddleVR.VRLog(1, "[<] Ending copy of the WebRTC server.");

        m_NetworkManager = FindObjectOfType <NetworkManager>();

        var startInfo = new ProcessStartInfo();

        startInfo.CreateNoWindow  = true;
        startInfo.UseShellExecute = false;
        startInfo.WindowStyle     = ProcessWindowStyle.Hidden;

        string pathToAppDataWebRTCServer = Path.GetFullPath(MiddleVR.VRKernel.GetAppDataFolder() + "\\MVRRTCServer");

        startInfo.WorkingDirectory = pathToAppDataWebRTCServer;
        startInfo.FileName         = pathToAppDataWebRTCServer + "\\node.exe";
        startInfo.Arguments        = pathToAppDataWebRTCServer + "\\server.js " + (m_NetworkManager.networkPort + 1).ToString();

        m_WebRTCServerProcess           = new Process();
        m_WebRTCServerProcess.StartInfo = startInfo;
        try
        {
            if (!m_WebRTCServerProcess.Start())
            {
                MiddleVR.VRLog(1, "[X] An error occured when launching the voice chat server, process already running.");
            }
        }
        catch (Exception e)
        {
            MiddleVR.VRLog(1, "[X] An error occured when launching the voice chat server.\n" + e.Message);
        }

        m_RTCServerURL = "https://" + m_NetworkManager.networkAddress + ":" + (m_NetworkManager.networkPort + 1).ToString();
    }
Exemplo n.º 19
0
    void OnPostRender()
    {
        MiddleVR.VRLog(3, "[ ] PostRender : " + name);
        vrCamera cam = MiddleVR.VRDisplayMgr.GetCamera(name);

        int id = -1;

        if (cam != null)
        {
            id = (int)cam.GetId();
        }

        GL.IssuePluginEvent(id);
    }
Exemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        m_it = new vrInteractionNavigationGrabWorld(Name);
        GC.SuppressFinalize(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_ReferenceNode  = MiddleVR.VRDisplayMgr.GetNode(ReferenceNode);
        m_NavigationNode = MiddleVR.VRDisplayMgr.GetNode(NavigationNode);

        if (m_ReferenceNode != null && m_NavigationNode != null)
        {
            m_it.SetActionButton(WandActionButton);

            m_it.SetReferenceNode(m_ReferenceNode);
            m_it.SetNavigationNode(m_NavigationNode);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationGrabWorld: One or several nodes are missing.");
        }
    }
    private void Start()
    {
        // Make sure the base interaction is started
        InitializeBaseInteraction();

        m_it = new vrInteractionNavigationElastic(Name);
        // Must tell base class about our interaction
        SetInteraction(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_ReferenceNode  = MiddleVR.VRDisplayMgr.GetNode(ReferenceNode);
        m_TurnAroundNode = MiddleVR.VRDisplayMgr.GetNode(TurnAroundNode);

        if (m_ReferenceNode != null && m_TurnAroundNode != null)
        {
            m_it.SetActionButton(WandActionButton);

            m_it.SetReferenceNode(m_ReferenceNode);
            m_it.SetTurnAroundNode(m_TurnAroundNode);

            m_it.SetTranslationSpeed(TranslationSpeed);
            m_it.SetRotationSpeed(RotationSpeed);

            m_it.SetDistanceThreshold(DistanceThreshold);
            m_it.SetAngleThreshold(AngleThreshold);

            m_it.SetUseRotationYaw(UseRotationYaw);

            m_it.SetFly(Fly);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationElastic: One or several nodes are missing.");
        }
    }
    protected void Start()
    {
        // Make sure the base interaction is started
        InitializeBaseInteraction();

        m_it = new vrInteractionNavigationGrabWorld(Name);
        // Must tell base class about our interaction
        SetInteraction(m_it);

        MiddleVR.VRInteractionMgr.AddInteraction(m_it);
        MiddleVR.VRInteractionMgr.Activate(m_it);

        m_ReferenceNode = MiddleVR.VRDisplayMgr.GetNode(ReferenceNode);

        if (m_ReferenceNode != null)
        {
            m_it.SetActionButton(WandActionButton);
            m_it.SetReferenceNode(m_ReferenceNode);
        }
        else
        {
            MiddleVR.VRLog(2, "[X] VRInteractionNavigationGrabWorld: One or several nodes are missing.");
        }
    }
Exemplo n.º 23
0
 void Start()
 {
     MiddleVR.VRLog(5, "[>] RenderPlugin: Initializing");
     InitRenderPlugin();
     MiddleVR.VRLog(5, "[<] RenderPlugin: Initialized");
 }
 void OnEnable()
 {
     MiddleVR.VRLog(3, "[ ] VRInteractionManipulationReturnObjects: enabled");
 }
Exemplo n.º 25
0
    protected void Start()
    {
        // Check if we are running MiddleVR
        if (MiddleVR.VRKernel == null)
        {
            Debug.Log("[X] VRManager is missing from the scene !");
            enabled = false;
            return;
        }

        if (SystemInfo.graphicsDeviceID == 0)
        {
            Debug.Log("[~] Running in batchmode - disabling VRWebView script");
            enabled = false;
            return;
        }

        m_VirtualMousePosition = new Vector2(0, 0);

        if (Application.isEditor)
        {
            // Get the vrCameras corresponding Cameras
            m_Cameras = new List <Camera>();

            uint camerasNb = MiddleVR.VRDisplayMgr.GetCamerasNb();
            for (uint i = 0; i < camerasNb; ++i)
            {
                vrCamera   vrcamera  = MiddleVR.VRDisplayMgr.GetCameraByIndex(i);
                GameObject cameraObj = GameObject.Find(vrcamera.GetName());
                Camera     camera    = cameraObj.GetComponent <Camera>();
                if (camera != null)
                {
                    m_Cameras.Add(camera);
                }
            }
        }

        m_Texture          = new Texture2D(m_Width, m_Height, TextureFormat.ARGB32, false);
        m_Texture.wrapMode = TextureWrapMode.Clamp;

        // Create vrImage and Texture2D
#if VRWEBVIEW_UNITY_FREE
        // Texture2D.SetPixels takes RGBA.
        m_Image        = new vrImage("", (uint)m_Width, (uint)m_Height, VRImagePixelFormat.VRImagePixelFormat_RGBA);
        m_Pixels       = m_Texture.GetPixels32(0);
        m_PixelsHandle = GCHandle.Alloc(m_Pixels, GCHandleType.Pinned);
#else
        // OpenGL and Direct3D 9: Memory order for texture upload is BGRA (little-endian representation of ARGB32)
        // Direct3D 11: Unity seems to ignore TextureFormat.ARGB32 and always creates an RGBA texture.
        // We let vrImage do the pixel format conversion because this operation is done in another thread.
        if (SystemInfo.graphicsDeviceVersion.Contains("Direct3D 11"))
        {
            m_Image = new vrImage("", (uint)m_Width, (uint)m_Height, VRImagePixelFormat.VRImagePixelFormat_RGBA);
        }
        else
        {
            m_Image = new vrImage("", (uint)m_Width, (uint)m_Height, VRImagePixelFormat.VRImagePixelFormat_BGRA);
        }
#endif

        // Fill texture
        Color32[] colors = new Color32[(m_Width * m_Height)];

        for (int i = 0; i < (m_Width * m_Height); i++)
        {
            colors[i].r = 0;
            colors[i].g = 0;
            colors[i].b = 0;
            colors[i].a = 0;
        }

        m_Texture.SetPixels32(colors);
        m_Texture.Apply(false, false);

#if !VRWEBVIEW_UNITY_FREE
        m_NativeTexturePtr = m_Texture.GetNativeTexturePtr();
#endif

        // Attach texture
        if (gameObject != null && gameObject.GetComponent <GUITexture>() == null && gameObject.GetComponent <Renderer>() != null)
        {
            var renderer = gameObject.GetComponent <Renderer>();

            // Assign the material/shader to the object attached
            renderer.material             = Resources.Load("VRWebViewMaterial", typeof(Material)) as Material;
            renderer.material.mainTexture = this.m_Texture;
        }
        else if (gameObject != null && gameObject.GetComponent <GUITexture>() != null)
        {
            gameObject.GetComponent <GUITexture>().texture = this.m_Texture;
        }
        else
        {
            MiddleVR.VRLog(2, "VRWebView must be attached to a GameObject with a renderer or a GUITexture !");
            enabled = false;
            return;
        }

        // Handle Cluster
        if (MiddleVR.VRClusterMgr.IsServer() && !MiddleVR.VRKernel.GetEditorMode())
        {
            MiddleVR.VRClusterMgr.AddSynchronizedObject(m_Image);
        }

        if (!MiddleVR.VRClusterMgr.IsClient())
        {
            if (m_DirectoryProviders.Length == 0 && m_ArchiveProviders.Length == 0)
            {
                m_WebView = new vrWebView("", GetAbsoluteURL(m_URL), (uint)m_Width, (uint)m_Height, m_Image);
            }
            else
            {
                m_WebView = new vrWebView("", "", (uint)m_Width, (uint)m_Height, m_Image);

                int order = 0;

                foreach (VRWebViewDirectoryProvider directoryProvider in m_DirectoryProviders)
                {
                    m_WebView.AddDirectoryProvider(directoryProvider.m_URL, Application.dataPath + System.IO.Path.DirectorySeparatorChar + directoryProvider.m_DirectoryPath, order, "VRWebViewProvider" + order);
                    order++;
                }

                foreach (VRWebViewArchiveProvider archiveProvider in m_ArchiveProviders)
                {
                    m_WebView.AddArchiveProvider(archiveProvider.m_URL, Application.dataPath + System.IO.Path.DirectorySeparatorChar + archiveProvider.m_ArchivePath, archiveProvider.m_Password, order, "VRWebViewProvider" + order);
                    order++;
                }

                m_WebView.SetURL(GetAbsoluteURL(m_URL));
            }
            m_WebView.SetZoom(m_Zoom);
        }
    }
Exemplo n.º 26
0
 void Start()
 {
     MiddleVR.VRLog(2, "[ ] Initializing RenderPlugin");
     InitRenderPlugin();
 }