I have had a google and cant seem to find anything specifically for this.
I have a tile map, I have mouse input, i have orthographic camera.
I would like to click a pipe in the tile map and know which tile has been clicked.
Apologies if this is covered somewhere else.
Can you show us a picture even to understand what you mean? My first assumption is that you are making some kind of top down game where you can click pipes (perhaps to rotate them, I don’t know, but I can only assume that each tile has a pipe on it) I am also assuming that you would like to know which tile the pipe you click is on.
If the tile and the pipe are one and the same you should be able to use a for each loop with break to cycle through all of the tiles until your selected tile matches.
If however, you have multiple pipes on top of each tile then you might want to use a line trace or have each pipe contain a variable of which tile it is on.
Of course there is also the possibility that you could be spawning the tiles and pipes randomly and procedurally…
If nothing I’ve said makes any sense, you may need to add a little more info to narrow down your specific desires.
So its like your first statement. There is an “in” tube on the left and an “out” tube on the right. by clicking the tubes in the middle I wish them to rotate 90 degrees.
I can code the rotation part but I am not 100% on how to work out which tile was clicked.
I have used line trace by channel for other 3d interactions however as I say i have had a google for examples of how to integrate that with 2d tile map but not found anything.
TIA
So, if this is all UI based, why not just make each pipe a button? Think of it like a chess board E3 F7 etc. Thats probably the cheapest way to do this. Each button would be it’s own widget with a variable that holds the info of its current rotation (good for procedural limitless levels), hope that makes sense
Apologies did not see response. I have moved to 3d version but thanks for trying.