Contents
How do you calculate the tile position in Excel?
To get the correct position you have to calculate it yourself. Here is an example of how to get the tile position at the mouse cursor if the grid is positioned at the xy-plane with z = 0
How to get the world coordinates of a tile?
If you have access to the Tile instance you can use its transform (or the raycast hit from the click) to get its world position and than get the tile coordinates via the WorldToCell method of your Grid component (look at the documentation ).
How can I get the tile GameObject by position?
Add half of the tile’s width ( 0.5 * GridLayout.cellSize.x) to the x of the position you are getting right now. You can use Vector3.Scale to do this: Thanks for contributing an answer to Stack Overflow!
How to get Vector3 coordinates for a tile?
I was not able to find anything in the Unity documentation for how to get the Vector3 coordinates for a selected tile in the Tilemap.
How to make a grid for an easy tile installation?
If you drew everything to scale on that paper including- the cabinets, walls and doorways you would be able to see exactly how all the tiles would fit in that room. Now imagine that piece of paper becoming the actual size of the room and now you can see these lines on the floor. Wouldn’t that be great!
How does the grid work with positioned items?
This defines the area for those items, which takes the 1st & 2nd rows and 1st & 2nd columns. The regular item stretches by default both horizontally and vertically, so it takes the whole size of the grid area. However, the positioned item shrink to fit and adapts its size to the contents.
How to get the tile position in Unity3D?
Here is an example of how to get the tile position at the mouse cursor if the grid is positioned at the xy-plane with z = 0 I couldn’t find a way to get the Grid’s position from mouse click, so instead I used a Raycast to Vector3, and then converted that to coordinates via the WorldToCell method of the Grid component as per Shirotha’s suggestion.