How to make a child object to stop following a parent?

Trying to implement a targeting system like in the good old alien shooter.
For convenience, I made the sight a child of the player(since the angles in this case are relative to the position of the player).
Naturally there was a problem: when you rotate the player turns around and the sight, in connection with which he begins to spin infinitely(
To solve this problem, in my opinion you have three options:
1)to the local coordinates of the sight relative to the player, and the sight should not be a child.
2)attach the sight to the global coordinates(extreme case)
3) the analogue of the function Vector3.Angle () with a specified starting point.
Code I can not show, because the script is only in theory.
I would like to know about the first and third
March 19th 20 at 08:25
3 answers
March 19th 20 at 08:27
4) make a hierarchy of {player}->{sight, the model}, and rotate the MODEL. A player's only move.

And why do you sight in the hierarchy of the player to place? It's kind of unrelated things - the sight-screen, player - world.
March 19th 20 at 08:29
he's not spinning correctly because of a couple probable causes.
- incorrect hierarchy
- invalid code
- still something wrong

The answer exact I can not show, as it is also only in theory.

(as the same you saw that he was spinning, code and screenshots of the hierarchy add to the issue. for telepaths it on the psychics)
Yes, in my opinion it is obvious. The guy is the model, its child object is the sight (do not know why, but suppose). Turn the model - turns and the sight relative to the model.

It seems to me that the sight is generally necessary to separately store - aka "the screen" - shane_Pacocha32 commented on March 19th 20 at 08:32
in spite of that sight)
and if the camera is under the player..
it turns the player. rotates the camera. rotates the scope. but relative to each other that they will remain in place if there is nothing by the script is not hung.

besides embarrassing "starts endlessly spinning", just making a child object to this are not as described or incorrect and in fact it's just a constant offset.

and Yes. on-screen sight separately somewhere in the stage to blurt out.
in General, all the same author to clarify what he was in his isometric (judging by the reference to alien shooter) Nalepa. - Aurelio_Kulas commented on March 19th 20 at 08:35
March 19th 20 at 08:31
I would have made the player model, and the sight of a child of the controller on which the camera is mounted, well, roughly speaking flying thing from the top. no problems then with the hierarchy and all the rest. Also it frees up a lot of problems in the future, and if you want to replace the player ? and so on

Find more questions by tags Unity Game Engine