Merge pull request #93855 from ayanchavand/fix-docs-code-anim

Fix AnimationMixer docs example code for `get_root_motion_rotation_accumulator`
This commit is contained in:
Rémi Verschelde 2024-07-02 13:57:36 +02:00
commit 9db1a963be
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -189,10 +189,10 @@
func _process(delta): func _process(delta):
if Input.is_action_just_pressed("animate"): if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate") state_machine.travel("Animate")
var current_root_motion_rotation_accumulator: Quaternion = animation_tree.get_root_motion_Quaternion_accumulator() var current_root_motion_rotation_accumulator: Quaternion = animation_tree.get_root_motion_rotation_accumulator()
var difference: Quaternion = prev_root_motion_rotation_accumulator.inverse() * current_root_motion_rotation_accumulator var difference: Quaternion = prev_root_motion_rotation_accumulator.inverse() * current_root_motion_rotation_accumulator
prev_root_motion_rotation_accumulator = current_root_motion_rotation_accumulator prev_root_motion_rotation_accumulator = current_root_motion_rotation_accumulator
transform.basis *= difference transform.basis *= Basis(difference)
[/gdscript] [/gdscript]
[/codeblocks] [/codeblocks]
However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases. However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases.