Character is the parent object and has camera object as its child object (FPS type).
Camera object has a script which 'throws' raycast to detect objects in front of it.
Camera object has a child object 'Crosshair', which has a script 'ShowCrosshair' attatched to it.
Character <- Camera <- Crosshair.
Expected behaviour should've been: I move the mouse up and down, camera rotates around y-axis and along with it the crosshair object moves smoothly remaining at the center of the screen.
But, whenever I move the mouse up/down, crosshair moves faster than the camera can rotate and goes out of sight.
Here's my code for Camera Rotate:
//vertical is float and is initially zero and transform is for the current gameObject i.e Camera
vertical -= Input.GetAxis("Mouse Y");
transform.localRotation = Quaternion.Euler(new Vector3(vertical, 0.0f, 0.0f));
This script is attached to Camera object.
It is desired that Crosshair move with camera that is why it's parented by camera object.