I have a 3D game dungeon crawler game. It's procedurally generated. I have a bunch of prefab rooms that are used to put together this dungeon. When not in combat the player uses a navmesh to move around and that works great. When in combat we switch to a turn based grid based system where we use A* for moving in this grid.
In each room prefab I add some markers to help identify things. For example I add a start and end position marker which defines the center of the corner tiles mathematically for a grid. So each room can have its own little grid where battles are played out.
The orientation of the room, and hence the grid inside it, can be anything around the y axis which is up/down.
My A* path finding library needs to know row/col when asking for a path. I can get the position based on the mouse picking and need to convert that to file position if done inside the grid. Because the orientation of a room can be rotated what a row/col is changes from what I may have had in mind when I placed the start and end grid positions in the prefab.
I'm wondering how can I make getting this row/col based on mouse pick position unified no matter what position or rotation the room is.