- Home /
 
 
               Question by 
               lucutes · Jun 08, 2020 at 11:43 AM · 
                unity 5scripting problemmovement  
              
 
              My character can move with WASD, but it slides and shows no animations
My code:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class Movement : MonoBehaviour
 {
     private Animator _animator;
 
     public float MaxSpeed = 10;
     // Start is called before the first frame update
     void Start()
     {
         _animator = GetComponent<Animator>();
     }
 
     // Update is called once per frame
     void Update()
     {
         if (_animator == null) return;
 
         var x = Input.GetAxis("Horizontal");
         var y = Input.GetAxis("Vertical");
 
         Move(x, y);
 
     }
 
     private void Move(float x, float y)
     {
         _animator.SetFloat("VelX", x);
         _animator.SetFloat("VelY", y);
 
         transform.position += (Vector3.forward * MaxSpeed) * y * Time.deltaTime;
         transform.position += (Vector3.right * MaxSpeed) * x * Time.deltaTime;
     }
 }
 
 
              
               Comment
              
 
               
              Answer by N-8-D-e-v · Jun 08, 2020 at 05:51 PM
In the animator tab turn on "use root motion" maybe? That can help depending on your animations
Your answer
 
             Follow this Question
Related Questions
Please Check the code and tell me why this isn't working?! 1 Answer
How to make sure than one script affect the player of the specific client, and not the other 2 Answers
Rpc logic with bools, using tutorial scripts, can't find the flaw 1 Answer