private void Update() { if (MainCamera.ScreenPointRaycast(GameInput.position, out hitInfo, 1 << layer)) { if (GameInput.BeginTouch()) { Draggable drag = hitInfo.collider.GetComponent <Draggable>(); if (drag) { dragStart = hitInfo.point; joint = gameObject.AddComponent <ConfigurableJoint>(); joint.xMotion = ConfigurableJointMotion.Locked; joint.yMotion = ConfigurableJointMotion.Locked; joint.zMotion = ConfigurableJointMotion.Locked; joint.connectedBody = drag.rigid; } } } if (GameInput.EndTouch()) { Destroy(joint); } }