Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Character in 2.5D runs "sideways" after i added animationcontroller

Discussion in 'Scripting' started by WideGamer, Aug 21, 2014.

  1. WideGamer

    WideGamer

    Joined:
    Aug 16, 2014
    Posts:
    4
    Hello, i am creating a 2.5D sidescroller, but my char is running "Sideways" when i controll him, if i try to rotate the char he still runs sideways, just in the wrong axis.

    Here is some links to my code, a guy said that this helped him when he followed the same tutorial:
    i displayed my eulerAngles in the console and moving left was 270 not -90 so i changed the hole thing to this transform.eulerAngles = (moveDir > 0) ? Vector3.up * 90 :Vector3.up * 270 ;

    But i dont realy see where i am supposed to change my code, i am pretty new at C# so any help would be realy appriciated, here is my links to my Github:


    PlayerControllerScript: https://github.com/WideGamer/SideScroller/issues/4

    PlayerPhysics: https://github.com/WideGamer/SideScroller/issues/3

    GameManager: https://github.com/WideGamer/SideScroller/issues/2

    GameCam: https://github.com/WideGamer/SideScroller/issues/1
     
  2. ScriptKid

    ScriptKid

    Joined:
    Aug 8, 2014
    Posts:
    23
    maybe just the wrong animation is triggered?
     
  3. WideGamer

    WideGamer

    Joined:
    Aug 16, 2014
    Posts:
    4
    The animations work, and do what they are told, its just the orientation of the character, postinga video of what happens:



    I belive theres a prolem with what the script says its the front of the char, i just need to find a way to rotate him in the script somwhere, Tried to read up on it, but i am not that good a C# yet to realy follow
     
  4. ScriptKid

    ScriptKid

    Joined:
    Aug 8, 2014
    Posts:
    23
    im not sure but your scripts look very messed up why do u try to move your character from different scripts? i just took a fast look on your scripts but i think u should handle things much more simple
     
  5. WideGamer

    WideGamer

    Joined:
    Aug 16, 2014
    Posts:
    4
    I am following a tutorial, i am pretty new at C#, and if you got any easyer ways to do this while learning i am all ears and would worship you as a god sir.

    I managed to get the char to move correctly, but my camera is just not following or willing to spawn my char.
     
  6. ScriptKid

    ScriptKid

    Joined:
    Aug 8, 2014
    Posts:
    23
    ok its hard to give u the right way to do it because there are many. in my opinion u should start from the scratch an then co further step by step. add a rigidody to your character and create a vector3 for the movement. now u can set the vector by the user input and then u could add the movement vector to the rigidbody in serveral ways like velocity or addforce.

    if u are new like me i recommend u to read as much as u can in the reference