Animate Object Related to Camera Position

Hello everyone…

I have idea about how to translate object. But here i have different circumstances.

I am having two left - right arrow buttons which are child of main camera.

Main camera is having zoom in effect…

Code for Camera :

    zoomTimePassed += Time.deltaTime;
	var t : float = zoomTimePassed / 1.0f;
	Camera.mainCamera.orthographicSize = Mathf.SmoothStep(120, 18, t);

Now my buttons are not active Until my camera size is 18.

When my camera size will become 18 , i want my buttons to translate like left button should translate from left side of screen and right button should translate right side of screen.

These button i have kept child of camera as my camera is following my player.

So which method should i use to make my button animation ?

Thanks . hope you guys understand my question.

Your question is pretty fuzzy to me, but I think you just want to do a local move (not a Translate). Something like:

 function LocalMove(localPos : Vector3, speed : float) {
     while (transform.localPos != localPos) {
          transform.localPosition = Vector3.MoveTowards(transofrm.localPosition, localPos, speed);
         yield;
     }
 }

When you detect orthograhicSize is 18, you would call this function once with the localPosition of where you want the button. Note that the values in the Inspector are local, so you can get the local position by setting the size to 18, then positioning the button and recording the value.