Hello guys, I’m having trouble making all connections (3 cylinders with ball) is facing the camera. The core (central sphere) rotates according to the mouse, and when this happens connections must rotate along with the nucleus always turning the cylinders at the camera.

What happens:

What I need:

Code used in connections:

```
var angle;
function Start() {
}
function Update () {
var center : GameObject = GameObject.Find("centro");
var dx = transform.position.x - Camera.main.transform.position.x;
var dy = transform.position.y - Camera.main.transform.position.y;
var radians = Mathf.Atan2(dy,dx);
if(center.transform.rotation.eulerAngles.x >= center.transform.rotation.eulerAngles.z)
{
angle = radians * 180 / Mathf.PI - (center.transform.rotation.eulerAngles.x/2*-1);
}
else
{
angle = radians * 180 / Mathf.PI + (center.transform.rotation.eulerAngles.z/2);
}
var rotateZ = Mathf.LerpAngle(transform.rotation.z, angle, 0);
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(transform.rotation.eulerAngles.x,transform.rotation.eulerAngles.y,rotateZ),1);
}
```

For 50% of angles this code works. In other cases the object is in the wrong rotation.