private void Start() { m_gridSnapManager = FindObjectOfType <GridSnapManager>(); Debug.Assert(m_gridSnapManager != null, "GridSnapManager doesn't eixst in current scene!"); m_cube = transform.Find("Cube").gameObject; m_interactableObjectScript = GetComponent <VRTK_InteractableObject>(); Debug.Assert(m_interactableObjectScript != null, "VRTK_InteractableObejct doesn't exist on " + transform.name); m_interactableObjectScript.InteractableObjectGrabbed += OnGrab; m_interactableObjectScript.InteractableObjectUngrabbed += OnThrow; }
private void Start() { m_player = GameObject.FindGameObjectWithTag("Player"); m_gridSnapManager = FindObjectOfType <GridSnapManager>(); Debug.Assert(m_gridSnapManager != null, "GridSnapManager doesn't eixst in current scene!"); //m_cube = transform.Find("Cube").gameObject; m_rigidBody = GetComponent <Rigidbody>(); m_rigidBody.isKinematic = true; m_rigidBody.useGravity = false; m_isXLocked = (m_rigidBody.constraints & RigidbodyConstraints.FreezePositionX) != RigidbodyConstraints.None; m_isYLocked = (m_rigidBody.constraints & RigidbodyConstraints.FreezePositionY) != RigidbodyConstraints.None; m_isZLocked = (m_rigidBody.constraints & RigidbodyConstraints.FreezePositionZ) != RigidbodyConstraints.None; m_interactableObjectScript = GetComponent <VRTK_InteractableObject>(); Debug.Assert(m_interactableObjectScript != null, "VRTK_InteractableObejct doesn't exist on " + transform.name); m_interactableObjectScript.InteractableObjectGrabbed += OnGrab; m_interactableObjectScript.InteractableObjectUngrabbed += OnStopGrab; }