public void OnTriggerEnter(Collider other) { if (other.GetComponent <ConnectorBehaviour>() && other.GetComponent <ConnectorBehaviour>().part_ScriptableObject.m_PartName == part_ScriptableObject.m_PartName) { if (isOfficial) { isOfficial = false; other.GetComponent <ConnectorBehaviour>().followTransform = transform; if (!needAnimation) { other.GetComponent <Collider>().enabled = false; m_Manager.changeStep(1); Collider[] allCollider = other.GetComponentsInChildren <Collider>(); foreach (Collider col in allCollider) { col.isTrigger = true; } } else { other.GetComponent <Collider>().enabled = true; other.GetComponent <ConnectorBehaviour>().needAnimation = true; other.GetComponent <ConnectorBehaviour>().m_Manager = m_Manager; transform.gameObject.SetActive(false); other.GetComponent <ConnectorBehaviour>().newPos = gameObject; Collider[] allCollider = other.GetComponentsInChildren <Collider>(); foreach (Collider col in allCollider) { col.isTrigger = true; //if (col.GetComponent<Rigidbody>()) //{ // col.GetComponent<Rigidbody>().velocity = Vector3.zero; //} } } SoundManager.instance.PlaySFX(SoundManager.SFX.FURNIT_CONN); } } else if (other.tag == "ScrewDriver" && needAnimation && m_Manager && !isOfficial) { // Spawning animation if (!other.gameObject.GetComponent <VRTK.VRTK_InteractableObject>().IsGrabbed()) { GameObject newScrewAnimation = Instantiate(screwAnimationPrefab, transform.position, transform.rotation); newScrewAnimation.GetComponent <ScrewAnimator>().currentConnector = this; needAnimation = false; screwDriver = other.gameObject; screwDriver.SetActive(false); GetComponent <Collider>().enabled = false; } } }