Add root motion accumulator to fix broken RootMotionView #72931
Merged
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 #72930.
rootmotionfix.mp4
Now we can get the actual blended rotation of the rotation with
get_root_motion_rotation_accumulator()
, not just the delta value.The following would allow the root motion position to be correctly applied while taking the object's orientation into account, without keeping the current rotation at the start of the animation. Now we can close #58061 completely.
I added a explanation of this code to the documentation. This should work even if the animation is Xfade or interrupted.
Also, using
get_root_motion_rotation_accumulator()
should be able to solve issue #67125. Closes #67125.We should discuss whether this is the good naming for the methods.
I think
get_root_motion_rotation_delta()
andget_root_motion_rotation()
would be better, but it would be breaks compat; This means to rename the currentget_root_motion_rotation()
toget_root_motion_rotation_delta()
and to rename this PR'sget_root_motion_rotation_accumulator()
toget_root_motion_rotation()
.Probably it is a better naming like
get_root_motion_rotation_base()
orget_root_motion_rotation_source()
?What do you think? @reduz @fire @lyuma @SaracenOne