-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make use of NavigationObstacle2D's transform #99030
Conversation
262a865
to
6a70062
Compare
6a70062
to
c373563
Compare
c373563
to
8928517
Compare
Reverted changes meant to prevent obstacle vertices to be affected by zero or negative scaling like in the 3D version and only show a warning in that case instead. The reason is that doing so would require modification to sensitive code in |
When I change the NavigationObstacle rotation the radius debug changes size. In the setup I have both the parent Node2D and the child NavigationObstacle scaled and rotated and translated. |
I think this may be a side effect of the logic used to ensure the radius is scaled only uniformly by the value of the largest global scale axis, but you are right that it feels strange and I'll take a look to see if that really is the case or if there is a coding mistake. |
I guess it is just the usual flaw with the Transform2D that has no real scale compare to 3D but just a rotation depending fake scale. |
Yeah, it looks like that's what's happening here. For the scale factor of the radius, I take the largest value of the How would you like me to handle this? I don't really see another sensible way of using the transform's scale to influence the radius, but the fact that it depends on the rotation is very counter-intuitive and I imagine would lead several people to report it as a bug. Do we leave it as is, or should we maybe just leave the radius alone and let it ignore the node transform? And if the latter, should I change the 3D PR to do it like that as well for consistency? If we stay with the current behavior I could change the warning that is already displayed when scaling a radius-based obstacle non-uniformly to also warn about unexpected behavior. Currently it just says "The agent radius can only be scaled uniformly. The largest scale value along the two axes will be used and skew is ignored." |
I would say just leave it as is, or add extra to the warning so people know that when they scale things the screw up same as they do with physics. |
8928517
to
e39fc3e
Compare
Alright! I expanded the warning, added an additional warning for skew, and added a clarifying comment somewhere else in the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the transform change.
Still needs code review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style seems fine to me.
Thank you for reviewing! I realized there is still one more missing functionality (transforming the vertices for the avoidance system) as discussed on RocketChat, so please don't merge the PR just yet 🙂 |
NOOOOOO, I SAW THIS TOO LAAAATE 😭 It's all good tho, just handle that in a separate PR & I'll fast-track a merge for it 👍 |
Haha no problem! I should have converted the PR to a draft, my bad. I'll need to fix both this and the 3D version of this PR anyway because of rebasing issues from another PR that was just merged so a making separate PR is suitable for that anyway. |
This is the follow up PR that implements what I missed in this one: #99176 🙂 |
Fixes #95820
2D version of #96730. Partially an enhancement and partially a fix because previously, editing a
NavigationObstacle2D
was broken if it or any of its ancestor nodes had a rotation, scale, or skew applied.The only thing missing as far as I can tell is to modifyNavigationObstacle2DEditor
so that the vertices are transformed by the modified safe transform (which prevents non-uniform scaling), as discussed on RocketChat.Edit: This should now be fully consistent and have feature parity with the 3D version of this PR. But I have not tested it extensively and the code may not be completely in line with Godot's conventions and guidelines, would need someone more familiar with the codebase to review and give feedback on it please 🙂