[#2874] Update Transform on Zone entity to outline's centroid on setPoints()#2875
Merged
Conversation
Reposition a Zone's transform to its centroid when modifying Zone points with the Lua API setPoints() function. setPoints() still accepts absolute coordinates as arguments, resulting in no change to the API. It then transforms and stores them as offsets relative to the Zone's Transform position. This is in line with how Zone functions and rendering already treat Zone outline points, and prevents all Zones from sharing the same 0,0 Transform position coordinates. This commit also modifies __exportZone to set the Transform position. Note that modifying Zone coordinates directly in the component member values does NOT update the Transform to the new centroid.
Contributor
Author
|
A potential workaround to #2874, but doesn't change the behavior when directly manipulating the Zone component's outline points via Lua member access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When setting a Zone's points via Lua
setPoints(), also set its Transform's position to the outline's centroid.Before: all Zones' transforms are at the same set of coordinates, typically 0,0
Screencast_20260606_112640.webm
After: each Zone's transform is at its centroid
Screencast_20260606_112235.webm