0
Under review

Find the world position for a room left corner

Anonymous 4 years ago • updated by Daedalus 4 years ago 7
I am working on a code that will spawn in designed rooms to fill the empty rooms. Is there a way to figure out how to calculate the world position of the room cell
Under review
You can have a look here for a list of all of the exposed methods; in your specific case, you could use GetObjectsOfType(SelectionObjectType type)
Ok I understand how to use the GetObjectsType....My prefab is a whole room in itself, I can capture the rooms cell so I know the cell location the room is generated. I am just trying to figure out how to translate that (i believe it is the left corner of the room) to a world postion.
Well, as of now, that's the best you can get with GetObjectsOfType, but given that your prefab is a whole room, you could just put an empty GO or something like that in the left corner of the room; how does that sound?
Nods...Question...does your cells function in a grid base, and the size of a tile...If that is true then I could multiply the cell location by the tile size to get the corner I am looking for?
Yes, of course it's grid-based, so if you're using modular stuff it should be easy to do what you say.
Thank you for the information.
You're welcome! Let us know if you need to know something else.