Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Rotation of non-Camera object not the same as the rotation viewed by the camera.

Discussion in 'Editor & General Support' started by dani00cooli, Oct 6, 2023.

  1. dani00cooli

    dani00cooli

    Joined:
    Jun 23, 2023
    Posts:
    1
    So basically I have a camera attached to a Player-Object. It has a movement and a camera movement (looking around) script (and some more which don't interact with the camera or the mentioned objects at all), as well as a CharacterController from unity and some 3D-Objects.
    My problem is that when I have a child to the camera and I give that child another child, which has a Sphere set 5 in front of the camera, and I rotate the camera, the sphere is not in the middle of the image shown by the camera. It is only in the middle of the camera (the middle being represented by a dot on the canvas which is static) when the rotation is (in euler) 0,90,180,270,360°.
    It is always a bit lower than the dot, which implies that the x-Rotation is not the same as the camera, even though it is (Numbers match up, same in the code).
    I have tested a lot of different methods and checked the script if they change anything about it, but even when I had just a camera moving a sphere, it did not match up. The Camera also doesn't have any settings that could result in the mentioned issue.
    The only option is that unity somehow doesnt rotate an object the same as its child in the newer version as I have tested it in a prior version in which it did match up.
    Any help or advice is greatly appreciated.
     
    Last edited: Oct 7, 2023