Search Unity

Transform co-ordinates overwriting each other when the camera rotates?

Discussion in 'Scripting' started by Lethn, Mar 20, 2019.

  1. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    I'm sure this has been answered before and I've found mentions here and there of this problem but I can get my camera to move absolutely fine with transform.Translate however when I try to add transform.Rotate in the mix the camera actually tilts rather than rotates. Could someone explain to me the mechanics of why this is? I'm trying to wrap my head around it and the solution, supposedly using EulerAngles fixes it but I'm still researching all of this.

    Oh yes! Sorry, I had gone and forgotten the correct term, I'm getting gimbal lock.
     
    Last edited: Mar 20, 2019
  2. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    I think I found the solution, possibly overthinking things there :p

    https://docs.unity3d.com/ScriptReference/Transform-eulerAngles.html