-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add linear/cubic angle interpolation to Animation::InterpolationType
for shortest 2D rotation
#64924
Merged
Conversation
This file contains 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
TokageItLab
commented
Aug 26, 2022
@@ -253,6 +253,35 @@ class Math { | |||
(-p_pre + 3.0f * p_from - 3.0f * p_to + p_post) * (p_weight * p_weight * p_weight)); | |||
} | |||
|
|||
static _ALWAYS_INLINE_ double cubic_interpolate_angle(double p_from, double p_to, double p_pre, double p_post, double p_weight) { |
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.
I implemented this for consistency. However, Animation uses cubic_interpolate_angle_in_time()
, so I am not sure if this is necessary.
reduz
approved these changes
Aug 26, 2022
TokageItLab
force-pushed
the
2drot
branch
2 times, most recently
from
August 26, 2022 13:51
cdaf8ec
to
e090a1a
Compare
Added document. |
fire-forge
reviewed
Aug 26, 2022
TokageItLab
force-pushed
the
2drot
branch
3 times, most recently
from
August 26, 2022 21:34
72fd035
to
9f83143
Compare
Thanks! |
1 task
aaronfranke
added a commit
to aaronfranke/godot-cpp
that referenced
this pull request
Sep 18, 2022
aaronfranke
added a commit
to aaronfranke/godot-cpp
that referenced
this pull request
Sep 19, 2022
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.
Fixes godotengine/godot-proposals#5245.
Add
INTERPOLATION_LINEAR_ANGLE
andINTERPOLATION_CUBIC_ANGLE
to perform 2D rotation in the shortest path.2d_rot_prev1.mp4
The result of the rotation is always normalized and may not match the key. But of course, the visual angle is the same. Also it needs more than three keyframes are needed for 360 degree rotation, but this is the same as Quaternion and Spine http://ja.esotericsoftware.com/forum/full-360-rotation-1031.
2d_rot_prev2.mp4
If there is more than one track to be blended that uses Angle interpolation, the blend will not exceed 180 degrees with respect to 0 or ResetTrack.
This is the same as the Quaternion blend, as commented in #57675 (comment), since only one value can be used as a basis for the path for consistent blending results.1
Since the fix of #60093, the 3D skeleton will use rest as the reference, but otherwise ResetTrack will be used as the reference. That documentation is my todo so I will write it in the future...
Footnotes
This prevents bone fractures and body penetration in Skeleton3D, but I don't know what will happen in Skeleton2D yet. In the worst case scenario, anyone may need to workaround the ResetTrack to change it in the middle of the animation, but for now, I will leave it. ↩