Skip to content
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: Normalized bones now respect non humanoid parent rotations #1353

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

0b5vr
Copy link
Contributor

@0b5vr 0b5vr commented Jan 18, 2024

Normalized bones now respect non humanoid parent rotations.

When the humanoid bone hierarchy has non-humanoid bones with rotation (e.g., hips have a parent node with rotation), normalized bones don't work properly.
This commit will fix this.

@0b5vr 0b5vr added the bug Something isn't working label Jan 18, 2024
@0b5vr 0b5vr added this to the next milestone Jan 18, 2024
@0b5vr 0b5vr requested a review from ke456-png January 18, 2024 03:56
@0b5vr 0b5vr self-assigned this Jan 18, 2024
Comment on lines -57 to -65
let parentWorldPosition: THREE.Vector3 | undefined;
let parentWorldRotation: THREE.Quaternion | undefined;
while (parentWorldPosition == null) {
let parentBoneWorldPosition: THREE.Vector3 | undefined;
while (parentBoneWorldPosition == null) {
currentBoneName = VRMHumanBoneParentMap[currentBoneName];
if (currentBoneName == null) {
break;
}
parentWorldPosition = boneWorldPositions[currentBoneName];
parentWorldRotation = boneWorldRotations[currentBoneName];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[memo]: VRMHumanBoneParentMap was used to reference a rotation of the parent bone, which was problematic when the parent was a non-humanoid bone with rotation.

Copy link
Contributor

@ke456-png ke456-png left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good.

@0b5vr 0b5vr merged commit f85cb36 into dev Jan 19, 2024
6 checks passed
@0b5vr 0b5vr deleted the fix-humanoid branch January 19, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants