-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fixed lerp of Transform2D which caused losing of skew #64418
Conversation
It would also be appreciated to add tests to the tests file located at |
Unit test committed. Is there anything else required for this PR? |
This fix seems to still be needed, but I am not sure if deconstructing to scale/rot/skew and reconstructing Transform2D from that is the right way. There may be a possibility that the reconstruction may break the accuracy of the 2D Basis. It may need to be clarified which accuracy should be prioritized. I remember Node3D separating the basis from the scale. @reduz Do you have any ideas? |
Upon closer investigation, the behavior in this PR is not correct. Test code: The behavior in this PR: godot.macos.editor.arm64.-.interp.DEBUG.-.28.January.2023.mp4The correct behavior (will submit a PR shortly): godot.macos.editor.arm64.-.interp.DEBUG.-.28.January.2023.1.mp4The code for the correct behavior:
We have to deconstruct and reconstruct in order to make this work with all of the edge cases. The simplest approach would be to slerp the Basis vectors, but this produces the same incorrect behavior as the first video. |
@aaronfranke Can that be applied to Transform3D::interpolate_with? Shear seems to be able to be extracted as shown in this article, so it might be worthwhile to reconstruct Transform3D using a same approach. As far as I remember, Transform3D and Transform2D interpolate_with is only used in limited areas (Skeleton?). So accuracy issue like separating scales in Node3D, may not be a problem here. |
@TokageItLab Right now we do not have any support for getting or setting skew/shear in Transform3D or Basis. If that is desired, it's a separate feature request. For this issue/PR it makes sense to support skew in Transform2D interpolation since there is already support for getting and setting the skew in Transform2D. |
@aaronfranke In Node3D, Skew is allowed (supported) if RotationMode is Basis. The axes and gizmo are not orthogonal, but its rotation with skew is definitely definable (since rotation by gizmo is performed correctly) and should be supported. |
@TokageItLab Sure, but since there is no high-level decomposition of the skew from the matrix, we either need to add that first so that we can do the decomposition, or use a more complicated interpolation approach. |
@aaronfranke Yes, I think we should. How do you think @reduz? |
Superseded by #72287. |
This PR fixes #64252. With this PR, the test project produces correct result of ((1, 0), (1, 1), (0, 0)),