Robot arm rotation problem

firstly im sorry for my poor english,
so i’m trying to rotate the last joint of an robot arm when it reach the target as showing in the picture,the idea that i want the orange circle to always look up, i tryed with lookAt() methode but it rotate all the joint, the problem that i want to rotate the joint on X axis and i cant find a solution for it.

please can any one help me.

Could you create a simple codepen replicating the issue? The description is a bit abstract and it’s a little hard to understand the exact problem based on 2D images :eyes: