/// <summary> /// Attempts to grab the object, if the object is not currently grabbed /// returns true /// </summary> /// <param name="parent"></param> /// <returns></returns> public virtual bool Grab(GameObject parent) { //Returns false if the object is already attached if (m_parent != null) { //Checks if the parent is a object socket otherwise the object shouldnt be grabbable. if (!m_parent.GetComponent <Socket>()) { return(false); } else { //If the object is a socket it removes the object from the socket m_parent.GetComponent <Socket>().RemoveObject(); } } //Set the collider to a trigger so that other things can still interact this.GetComponent <Collider>().isTrigger = true; //Disables the rigidbody this.GetComponent <Rigidbody>().isKinematic = true; //Attach the object to the hand this.transform.SetParent(parent.transform); m_parent = parent; if (m_shaderController != null) { m_shaderController.DisableOutline(); } else { Debug.LogError("Shader Controller Missing from <a>" + this.gameObject.name + "<a> ", this.gameObject); } return(true); }