problem with rotate around dynamic object

Hello the guy,i would like turn my object A around a dynamic object B with a variable angle

var TargetObject : GameObject;
var  angle:float;
function Update () 
{var direction = Vector3(0, Mathf.Sin(Mathf.Deg2Rad * angle)*5, Mathf.Cos(Mathf.Deg2Rad * angle)*5);
this.transform.position = TargetObject.transform.position + direction;

It’s ok, but when my Object B rotate around his Y axis, object A don’t turn with him.
Can you help me please?

Ok, it seems that this algorithm took precedence over the child-parent relationship between A and B. So I managed to integrate the Y rotation of the object B in trigonometrique equation.

var TargetObject : Transform;
var  angle:float;
   function Update () 
 var TargetAngleY :float;
 var direction = Vector3( Mathf.Sin(Mathf.Deg2Rad * TargetAngleY)*5,Mathf.Sin(Mathf.Deg2Rad * angle)*5, Mathf.Cos(Mathf.Deg2Rad * (TargetAngleY+angle))*5);
this.transform.position = TargetObject.transform.position + direction  ;

The fact that the object B is the parent of object A Changes nothing. Everything works fine now thank you very much for your answers