Setting Vector3.angle between two gameObjects

So here is the question: I am able to get an angle between two gameObjects by using Vector3.angle

public Transform target;
void Update()
    Vector3 targetDir = target.position - transform.position;
    float angle = Vector3.Angle(targetDir, transform.forward);

but the real problem is that I want to set this angle to another two gameObjects which are at different positions and angles in world space…

Thank You

(I am sorry but i was not able to upload images because i am getting a disgusting error in unity answers which says - Error parsing the uploaded file.)

@ShamimAkhter Yes, I know that it is the angle between transform.forward of the gameobject at which the script is attached and the other one. I want the same angle between the 3rd gameobject’s transform.forward with 4th gameobject. I know it seems complicated but I have a graphical representation of the same but I am not able to upload it due to the error.

Ok. You need to rotate your 3rd_gameObject so as to make the angle between its forward and 4th_gameObject equals to “angle”.

Lets find the rotation axis. You can do it using: Vector3.cross(3rd_gameObject.transform.forward, targetDir); where targetDir will be (3rd_gameObject.position - 4th_gameObject.position).

Then rotate your 3rd_gameObject: 3rd_gameObject.transform.rotation = Quaternion.AngleAxis(angle, rotationAxis)