# Align the center of Camera towards a position in the world

I have a third-person view of an archer that shoot arrows.
What I want to solve: I want the crosshair in the middle of the screen to follow the position my bow is aiming at, by rotation the camera so that the aim position overlaps with the crosshair.

I use a script on the bow object to find the aim position:

`bow.cs`
UPDATED WITH SOLUTION UNDER

`private Vector3 aimAtPosition;`
```private void FixedUpdate()
{
RaycastHit hit;
Vector3 transformDirection = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast(transform.position, transformDirection, out hit, 800))
{
float distance = Vector3.Distance(hit.transform.position, transform.position);
aimAtPosition = transformDirection * distance;
return;
}
aimAtPosition = transformDirection * 800;
}```
```public void getBowTarget()
{
return aimAtPosition;
}```

And then I use a script on the camera parent object to try and rotate towards it:

`cameraParent.cs`

`transform.LookAt(bowScript.getBowTarget());`

Crosshair:

```void OnGUI()
{
GUI.DrawTexture(new Rect(Screen.width / 2,Screen.height / 2, 60, 60), crosshairTexture, ScaleMode.ScaleToFit, true, 10.0F);
}```

The rotation of the camera looks good, but the camera is not centering on the `aimAtPosition`. It is not precise.
Is there a better way than to use the `LookAt` method to center the camera on a position in the world?

Following code not tested:

``````// Bow.cs

public Vector3 Target { get ; set ;}

private void FixedUpdate()
{
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 50))
{
Target = hit.point;
}
else
{
Target = ray.GetPoint(50);
}
}
``````

``````// CameraParent.cs

transform.LookAt(bowScript.Target);
``````

``````// Crosshair.cs
void OnGUI()
{
GUI.DrawTexture(new Rect(Screen.width / 2,Screen.height / 2, 60, 60), crosshairTexture, ScaleMode.ScaleToFit, true, 10.0F);
}
``````

Uhm I don’t see an issue with your lookat code. However you don’t draw your crosshair in the center of the screen since you use this rect:

``````new Rect(Screen.width / 2,Screen.height / 2, 60, 60)
``````

So your Rect starts at the screen center and extends 60 to the right and 60 downwards. You probably wanted to do

``````new Rect(Screen.width / 2 - 30,Screen.height / 2 - 30, 60, 60)
``````

assuming that the center of your crosshair should be the actual center to aim at.