/// <summary> /// ジョイントをアタッチする /// </summary> /// <param name="objcet"></param> private void AttachFixedJoint() { FixedJoint joint; Rigidbody rigidbody; if (!HasController()) { return; } MyController controller = m_controller.GetComponent <MyController>(); if (controller == null) { return; } if (controller.GetGrabNum() != 0) { return; } if ((joint = GetComponent <FixedJoint>()) == null) { joint = gameObject.AddComponent <FixedJoint>(); } if (joint.connectedBody != null) { return; } if ((rigidbody = m_controller.GetComponent <Rigidbody>()) == null) { rigidbody = m_controller.AddComponent <Rigidbody>(); //柔軟 } transform.position = controller.GetTransform().position; joint.connectedBody = rigidbody; }