Room.CenterRoom not working

Hi all,

I’m trying to align room center points and room tags to the center of the room.

For some reason the script is not working properly. it doesnt give errors but its just not placing the rooms in the middle.

Any thoughts?


It’s probably because it averages out the corner points to get the ‘centre’ of the set and thus the ‘centre’ of the room. Square rooms do not necessarily have four points due to the addition of vertexes where wall junctions bound the room which means the centre point will be weighted to where the extra points are and shift it off-centre from where you would naturally expect it to be.

To find the true centre of the room will require far more complex calculations. Computing the medial axis would be a good start but then you’ll still need to determine your own evaluation as to what would constistute the room centre especially on more complex rooms which might branch, such as corridors or L shaped rooms (which normally result in centre points outside the bounds of the room if only the corner points are averaged!).

Hmm, makes sense but that’s not the problem. when i move the centerpoint manualy and run the script it still stays where i moved it.