Character not turning properly. (first unity project)

I just started using unity and I figured I’d start by making a character.

My character wont turn left or right when “Apply root motion” is disabled how ever it will when I enable it but then the animation stops. I think it’s a problem with the script but as I said I just started so I’m not sure whats wrong.

With root motion enabled:

With root motion disabled:

My script:Imgur: The magic of the Internet

Any help would be appreciated :slight_smile:

Ps I got the script from this tutorial:

use transform.eulerAngles instead

I messed around with the script a bit but still the same problem :confused:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Anim : MonoBehaviour {

    public Animator playerAnim;

    // Use this for initialization
    void Start ()
    {
        playerAnim = GetComponent<Animator>();
    }
   
    // Update is called once per frame
    void Update ()
    {
        float walkInput = Input.GetAxis("Horizontal");

        if (walkInput > 0f)
        {
            playerAnim.SetBool("Walking",true);
            transform.eulerAngles = new Vector3(0,-90,0);
        }
        else if (walkInput < 0f)
        {
            playerAnim.SetBool("Walking",true);
            transform.eulerAngles = new Vector3(0,90,0);
        }
        else
        {
            playerAnim.SetBool("Walking",false);
            transform.eulerAngles = new Vector3(0,0,0);
        }


    }
}

It’s much easier to start making a psuedo character by just using movement, and not including animation.
Then you can get a feel for how it’s working and later add the animation. :slight_smile: At least, in my opinion.

For future reference, have a look at this page: Using code tags properly - Unity Engine - Unity Discussions
It will show you how you can post your scripts/code on the forums in a nicely formatted fashion.

Welcome to Unity :slight_smile: