ok my problem his the player follow the mouse and its work ok but after colliding whit the enemy its stop do it wall please help me i try to fix this for 2 days lol(the enemy follow the player) its look like he have momentum from the enemy but after they stop coliid the movement in the direction of the movement don’t stop , I mean he follow the mouse but he have speed in the direction the enemy colid whit him this is top-down game
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovment : MonoBehaviour
{
[SerializeField]
float MoveSpeed = 0.34f;
Vector2 MouseInWorld;
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
MouseInWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.position = Vector3.Lerp(transform.position, MouseInWorld, MoveSpeed);
}
}