toebeann / SnapBuilder

Snap-to-Grid in Subnautica!
https://www.nexusmods.com/subnautica/mods/427
GNU Lesser General Public License v3.0
5 stars 1 forks source link

Hotfix: Large room wall snapping #38

Closed toebeann closed 3 years ago

toebeann commented 3 years ago

Since 1.3.7, we began using the parent (where possible) of the hit.transform for localising the hit point, as this gave better results in the case of the floor of multipurpose rooms etc. However, we also were further using that parent's parent transform (where possible) for localising the hit normal, and in all of our testing this was working appropriately. However, we neglected to test large rooms, and this two-steps-removed localisation of the normal causes an issue in large rooms where on certain sections of the wall, snapping ceases to function. So, this PR uses the same transform as the original step - if the parent was chosen for the hit point, use that same transform to localise the normal, never its parent. If the parent was not chosen, use the original transform for normal localisation as well.

This has been tested on the floors and walls of both multipurpose rooms and large rooms, and on standard surfaces outside, and does not seem to cause any regressions.