#AOE indicador vs mouse position

1 messages · Page 1 of 1 (latest)

rugged fjord
#

I'm drawing an aeo indicator on the mouse position with the following code:

private Vector3 GetMousePosition()
   {
       Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

       // Plano horizontal en Y = 0
       Plane groundPlane = new Plane(Vector3.up, Vector3.zero);

       if (groundPlane.Raycast(ray, out float enter))
       {
           return ray.GetPoint(enter); // Punto donde el rayo intersecta el plano
       }

       return Vector3.zero;
   }

I tried placing this in the update, late update and fixed update but in all cases the indicator is lagging behind the mouse position. This happens in the editor and the build as well