Hello
I have a problem in scripting player attach the rope(grab it)
I want that my character always has specific distance to the rope even when my 2d rope has swing.
With the codes below the character doesn’t the distance any time!
please help me about this.

void OnTriggerEnter2D(Collider2D col){
if (col.tag == "Rope") {
if(!isRopeMode){
isRopeMode = true;
tempRope = col.gameObject;
GetComponent<Rigidbody2D> ().gravityScale = 0;
GetComponent<Rigidbody2D> ().isKinematic = true;
}else{
}
}
}
private void FixedUpdate()
{
if (isRopeMode) {
transform.position = new Vector2 (tempRope.transform.position.x - 0.2f, transform.position.y);
transform.rotation = tempRope.gameObject.transform.GetChild(0).transform.rotation;
}
}