i'm just copying my question from [here](#❓┃quick-help message)
is there a known issue with raycast2d's GetCollisionPoint() getting the incorrect coordinates for tilemaplayers?
this is my code:
private void CheckRaycast()
{
if (!PlayerRayCast.IsColliding())
{
return;
}
Vector2 collPos = PlayerRayCast.GetCollisionPoint();
MineTile(collPos);
}
public void MineTile(Vector2 coords)
{
Vector2 localPos = tileMapMain.ToLocal(coords);
Vector2I cell = tileMapMain.LocalToMap(localPos);
//GD.Print("hitting " + coords + " " + localPos + " " + cell);
tileMapMain.EraseCell(cell);
}
i can mine the tile below the player, from the right of the player, and downright of the player. tiles are 16x16 px, tilemaplayer's coordinates are 0 0.
but when i try to mine a tile to the left of the player, it gets the tile off by 1 to the right
as you can see in the console it's off by 1 to the right when i'm next to it on the left, but not when i'm on top mining down, or on the left side mining to the right
mining up also does not work, it's also off by 1 down