Child game-object moving faster than parent game-object
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.
Expected behaviour should've been: I move the mouse up and down, camera rotates around an 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 globaly defined and transform is for the current gameObject i.e
//Camera
vertical -= speedV * Input.GetAxis("Mouse Y");
vertical = Mathf.Clamp(vertical, -50, 70);
transform.localRotation = Quaternion.Euler(new Vector3(vertical, 0.0f, 0.0f));
Your answer
Follow this Question
Related Questions
Why does my transform.lookat not work? 1 Answer
How to make one movement direction be equal to diferent cameras? 2 Answers
Spyro Like Camera Follow 0 Answers
FPS camera rotating uncontrollably 0 Answers