private void Ungrab()
    {
        if (m_CurrentManipulatedObject == null)
        {
            return;
        }

        // Give to return objects script
        VRInteractionManipulationReturnObjects returningObjectScript = this.GetComponent <VRInteractionManipulationReturnObjects>();

        if (returningObjectScript != null)
        {
            if (returningObjectScript.enabled)
            {
                returningObjectScript.AddReturningObject(m_CurrentManipulatedObject, m_ObjectInitialLocalPosition,
                                                         m_ObjectInitialLocalRotation, false);
            }
        }

        // Reset
        m_it.SetManipulatedNode(null);

        VRActor vrActorScript = m_CurrentManipulatedObject.GetComponent <VRActor>();

        vrActorScript.SyncDirection = m_ObjectPreviousSyncDir;

        m_CurrentManipulatedObject = null;

        // Reactivate selection after the manipulation
        if (m_PausedSelection != null)
        {
            MiddleVR.VRInteractionMgr.Activate(m_PausedSelection);
            m_PausedSelection = null;
        }
    }
Esempio n. 2
0
    private void _EnableManipulationReturnObjects(bool iEnable)
    {
        m_ManipulationReturnObjects = iEnable;

        VRInteractionManipulationReturnObjects returnObjects = m_Wand.GetComponent <VRInteractionManipulationReturnObjects>();

        if (returnObjects != null)
        {
            returnObjects.enabled = m_ManipulationReturnObjects;
        }
    }
    private void Ungrab()
    {
        if (m_CurrentManipulatedObject == null)
        {
            return;
        }

        if (OnGrab != null)
        {
            OnGrab(this, e_GrabStatus.UNGRABBED);
        }

        // Give to return objects script
        VRInteractionManipulationReturnObjects returningObjectScript = this.GetComponent <VRInteractionManipulationReturnObjects>();

        if (returningObjectScript != null)
        {
            if (returningObjectScript.enabled)
            {
                returningObjectScript.AddReturningObject(m_CurrentManipulatedObject, m_ManipulatedObjectInitialLocalPosition,
                                                         m_ManipulatedObjectInitialLocalRotation, false);
            }
        }

        // Reset
        m_it.SetManipulatedNode(null);

        VRActor vrActorScript = m_CurrentManipulatedObject.GetComponent <VRActor>();

        vrActorScript.SyncDirection = m_ObjectPreviousSyncDir;

        // Unpause rigidbody acceleration
        Rigidbody manipulatedRigidbody = m_CurrentManipulatedObject.GetComponent <Rigidbody>();

        if (manipulatedRigidbody != null)
        {
            manipulatedRigidbody.isKinematic = m_ManipulatedObjectInitialIsKinematic;
        }

        // Reactivate selection after the manipulation
        if (m_PausedSelection != null)
        {
            MiddleVR.VRInteractionMgr.Activate(m_PausedSelection);
            m_PausedSelection = null;
        }

        m_CurrentManipulatedObject = null;
    }
    private void Ungrab()
    {
        if (m_CurrentManipulatedObject == null)
        {
            return;
        }

        // Give to return objects script
        VRInteractionManipulationReturnObjects returningObjectScript = this.GetComponent <VRInteractionManipulationReturnObjects>();

        if (returningObjectScript != null)
        {
            if (returningObjectScript.enabled)
            {
                returningObjectScript.AddReturningObject(m_CurrentManipulatedObject, m_ManipulatedObjectInitialLocalPosition,
                                                         m_ManipulatedObjectInitialLocalRotation, false);
            }
        }

        // Reset
        m_it.SetManipulatedNode(null);

        ReleaseGameObjectNode(m_CurrentManipulatedObject);

        // Show Wand
        m_VRMgr.ShowWandGeometry(true);

        // Unpause rigidbody acceleration
        Rigidbody manipulatedRigidbody = m_CurrentManipulatedObject.GetComponent <Rigidbody>();

        if (manipulatedRigidbody != null)
        {
            manipulatedRigidbody.isKinematic = m_ManipulatedObjectInitialIsKinematic;
        }

        // Reactivate selection after the manipulation
        if (m_PausedSelection != null)
        {
            MiddleVR.VRInteractionMgr.Activate(m_PausedSelection);
            m_PausedSelection = null;
        }

        m_CurrentManipulatedObject = null;
    }