how to make Doors or something similar with joints

what I’m trying to do is that it rotates around cylinder

well I know that fixjoint is no go for this I tried with hinge joint but it just goes down not around it

why I said doors because doors behave same way as this does it rotates around 1 / 2 points

I want with joints please

there is a function to rotate around another object

wooh I’ve done it

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[System.Serializable]

public class Nail : MonoBehaviour {
	public List<Collider> Collide;
	
	void OnTriggerEnter (Collider Other){
			Collide.Add(Other);
	}
	void OnTriggerExit (Collider Other){
		for (int i = 0; i<Collide.Count; i++) {
			if (Collide *== Other){*
  •  		Collide.RemoveAt(i);*
    
  •  	}*
    
  •  }*
    
  • }*
  • void Update () {*
  •  	for (int i=0; i<Collide.Count; i++) {*
    
  •  		HingeJoint FixJoint;*
    

_ FixJoint = Collide*.gameObject.AddComponent(“HingeJoint”) as HingeJoint;_
FixJoint.anchor = new Vector3 ( ((transform.position.x - Collide_.transform.position.x) / Collide.transform.localScale.x),
((transform.position.y - Collide.transform.position.y) / Collide.transform.localScale.y),
((transform.position.z - Collide.transform.position.z) / Collide.transform.localScale.z));
FixJoint.axis = new Vector3 (0,0,1);
FixJoint.connectedBody = gameObject.rigidbody;
}
}
}*_