I’m making 2D, top-down movement and I’m using the character controller component. It works fine but when I stop moving the player slides around. This also happens when changing direction, which makes it unresponsive and frustrating to play. Here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public CharacterController controller;
// Update is called once per frame
void Update()
{
float x = Input.GetAxis("Horizontal") * moveSpeed;
float y = Input.GetAxis("Vertical") * moveSpeed;
Vector3 move = new Vector3(x , y , 0);
controller.Move(move);
}
}