Yes, I tried to untick the nav Mesh Agent of the enemy and the shakings are no more. But I don’t think it should remain untick for the next.
here is a video of my problem, I hope it is visible enough. https://youtu.be/7yPhf4gHNZM
and my Player Controller :
using UnityEngine;
using RPG.Movement;
using RPG.Combat;
namespace RPG.Control
{
public class PlayerController : MonoBehaviour
{
private void Update()
{
if (InteractWithCombat()) return;
if (InteractWithMovement()) return;
print("Nothing to do!");
}
private bool InteractWithCombat()
{
RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());
foreach (RaycastHit hit in hits)
{
CombatTarget target = hit.transform.GetComponent<CombatTarget>();
if (target == null) continue;
if (Input.GetMouseButtonDown(0))
{
GetComponent<Fighter>().Attack(target);
}
return true;
}
return false;
}
private bool InteractWithMovement()
{
RaycastHit hit;
bool hasHit = Physics.Raycast(GetMouseRay(), out hit);
if (hasHit)
{
if (Input.GetMouseButton(0))
{
GetComponent<Mover>().StartMoveAction(hit.point);
}
return true;
}
return false;
}
private static Ray GetMouseRay()
{
return Camera.main.ScreenPointToRay(Input.mousePosition);
}
}
}
Thanks for your quick reply.