Esempio n. 1
0
        public void SelectRoleSet(int index)
        {
            m_roleSetButtonList[index].SetIsOn();

            if (m_selectedRoleIndex == index)
            {
                return;
            }

            m_selectedRoleIndex = index;

            m_boundDevices.Clear();

            RefreshSelectedRoleBindings();

            if (m_onSelectRoleSet != null)
            {
                m_onSelectRoleSet.Invoke(selectedRoleMap);
            }
        }
Esempio n. 2
0
        protected void ClearGrabbers(bool doDrop)
        {
            if (m_grabbers.Count == 0)
            {
                return;
            }

            CheckRecursiveException("ClearGrabbers");

            if (m_beforeGrabberReleased != null)
            {
                m_grabMutex = true;
                m_beforeGrabberReleased();
                m_grabMutex = false;
            }

            m_grabbers.Clear();
            currentGrabber = null;

            if (doDrop)
            {
                if (grabRigidbody != null && !grabRigidbody.isKinematic && m_poseSamples.Count > 0)
                {
                    var framePose = m_poseSamples.Dequeue();
                    var deltaTime = Time.time - framePose.time;

                    RigidPose.SetRigidbodyVelocity(grabRigidbody, framePose.pose.pos, transform.position, deltaTime);
                    RigidPose.SetRigidbodyAngularVelocity(grabRigidbody, framePose.pose.rot, transform.rotation, deltaTime, overrideMaxAngularVelocity);

                    m_poseSamples.Clear();
                }

                if (m_onGrabberDrop != null)
                {
                    m_onGrabberDrop();
                }
            }
        }