-
-
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
Fix XRBodyModifier3D hip driving for avatars no Root bone #89727
Fix XRBodyModifier3D hip driving for avatars no Root bone #89727
Conversation
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.
lgtm
At a first glance a hips bone is not a root bone and shouldn’t be a root bone. I’ll try to give a proper answer or someone from the animation can be more detailed. We’re at GDC. |
I assume that adding RootBone would seem to be better than using Hips as RootBone. (If necessary, such a feature may need to be added to Retargeter as well) |
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 have seen a PR somewhere that tried to extract the root motion from the hips transformation at realtime in AnimationTree, but I remember that it was rejected because it would not be good for performance.
Also, just yesterday, reduz and I were discussing moving the root motion from AnimationMixer to Skeleton3D, and in this case, using Hips as Root is also not a good idea for the same reason as above.
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.
Oh, sorry, I misunderstood the PR.
If this is a PR to "do nothing" instead of "include RootMotion in Hips", then it makes sense.
The purpose of this PR is indeed to prevents the hips from erroneously being driven with "root motion" rules. My Godot Mocap plugins (VMC, Movella, AxisStudio) do synthesize root motion from the hips - because the mocap data-stream they're consuming doesn't include root motion information. It's just a Vector3.slide to project the hips onto the floor, followed by a double-cross-product to orient the joint facing upwards. # Get the hips transform
var hips : Transform3D = _body_tracker.get_joint_transform(XRBodyTracker.JOINT_HIPS)
# Construct the root under the hips pointing forwards
var root_y = Vector3.UP
var root_z = -hips.basis.x.cross(root_y)
var root_x = root_y.cross(root_z)
var root_o := hips.origin.slide(Vector3.UP)
var root := Transform3D(root_x, root_y, root_z, root_o).orthonormalized() |
06abc86
…bone Fix XRBodyModifier3D hip driving for avatars no Root bone
Thanks! |
The XRBodyModifier3D node fails to correctly drive avatars which have no Root bone. This occurs on common avatars such as ReadyPlayerMe, Mixamo, and AvaturnMe where the root bone of the skeleton is the hips. The importers Skeleton Retarget doesn't add a Root but instead leaves the Hips as the root bone but with the corrected name.
The XRBodyModifier3D code assumes their must always be a bone associated with the Root tracking joint, and picks bone 0 (the first bone) if it didn't find it by the correct bone name. Unfortunately if it does this with an avatar where bone 0 is the hips then it associates the hips with the root and locks the hips in place.
This PR removes the offending code:
godot/scene/3d/xr_body_modifier_3d.cpp
Lines 255 to 258 in 89f70e9
With this removed the behavior is as follows:
The following video demonstrates four different avatars moving correctly:
Avatars.mp4