-2

My camera is a child object of an empty gameobject, that I wish to rotate. The camera is a few units out of the center, so that it can rotate around objects placed in the same place as the empty game object. Standard fare, I am sure.

However, when I try to rotate the parent, the camera remains stationary in the world, rotating in place. I have tried a few different approaches, but it always results like this.

A schematic overview of the situation

parent.transform.eulerAngles = new Vector3(0, 0, 90);

The strange thing, is when I do change the Parent rotation in the Inspector, it works as intented.

[EDIT] The camera has a script attached that determines its X axis position. Apparantly I need to make some changes to that script, then this one should work as intented. Thank you all for your time anyway.

1 Answers1

0

For future reference, and in case others stumble upon this one. If you give a child a position in code, double-check if its a localPosition. This might be the cause of all your worries.

  • The question should be updated to include the code that caused this problem... questions which don't contain enough code to reproduce the problem are considered off topic and should be closed. I like the diagram, it explains most of the situation very well, so I would not like to see the question closed :s See [What topics can I ask about here?](https://stackoverflow.com/help/on-topic) for more information – Ruzihm Dec 17 '20 at 15:53