my enemies are floating below the ground’s level and nodes aren’t getting blocked. Also some enemies do follow the updated path and some follow the initial path.
My code for GridManager’s GetPositionFromCoordinates and GetCoordinatesFromPosition methods are as follows:
public Vector2Int GetCoordinatesFromPosition(Vector3 position){
Vector2Int coordinates = new Vector2Int();
coordinates.x = Mathf.RoundToInt(position.x / unityGridSize);
coordinates.y = Mathf.RoundToInt(position.z / unityGridSize);
return coordinates;
}
public Vector3 GetPositionFromCoordinates(Vector2Int coordinates){
Vector3 position = new Vector3();
position.x = Mathf.RoundToInt(coordinates.x * unityGridSize);
position.z = Mathf.RoundToInt(coordinates.y * unityGridSize);
return position;
}
I though at first maybe my code was wrong as i saw a previous similar post, still couldn’t figure out. Please Help me
!! (I am using Unity 2022 )