Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Camera Rotation On top down game

Discussion in 'Scripting' started by 787gabriel777, Dec 15, 2015.

  1. 787gabriel777

    787gabriel777

    Joined:
    Jul 20, 2015
    Posts:
    65
    Hello, i have this script:
    transform.eulerAngles = Vector3(0, 0, 0);
    My camera rotation Z, dont stop, he shake a lot, and i dont know what is wrong
    What i can do?
     
    Last edited: Dec 15, 2015
  2. CloudKid

    CloudKid

    Joined:
    Dec 13, 2015
    Posts:
    207
    Post all the camera code, not just a line pls. And pls use code tags
     
  3. 787gabriel777

    787gabriel777

    Joined:
    Jul 20, 2015
    Posts:
    65
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. function Start () {
    4.  
    5. }
    6.  
    7. function Update () {
    8.    
    9.     transform.eulerAngles = Vector3(0, 0, 0);
    10.  
    11. }
     
  4. CloudKid

    CloudKid

    Joined:
    Dec 13, 2015
    Posts:
    207
    If you comment line 9 does your camera stop or is it still shaking?
     
  5. 787gabriel777

    787gabriel777

    Joined:
    Jul 20, 2015
    Posts:
    65
    no, but rotate with my caracter, what i can do to stop this?
     
  6. 787gabriel777

    787gabriel777

    Joined:
    Jul 20, 2015
    Posts:
    65
     
  7. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    is your camera a child of the player?

    usually in something like a top down shooter your camera is separate and uses scripts to move it to where it needs to be.

    Failing that, you might try using LateUpdate() rather than Update(), it can help when trying to do "multiple" movements on one gameobject per frame (i.e. move/rotate with parent player, move/rotate with its own script).
     
  8. 787gabriel777

    787gabriel777

    Joined:
    Jul 20, 2015
    Posts:
    65
    have another way?