Skip to content

Commit

Permalink
Merge pull request #1057 from AlaricBaraou/dev
Browse files Browse the repository at this point in the history
Fix hips world position update
  • Loading branch information
0b5vr authored Sep 28, 2022
2 parents a90924d + e0a1535 commit 594567d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/three-vrm-core/src/humanoid/VRMHumanoidRig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { VRMRig } from './VRMRig';

const _v3A = new THREE.Vector3();
const _quatA = new THREE.Quaternion();
const _boneWorldPos = new THREE.Vector3();

/**
* A class represents the normalized Rig of a VRM.
Expand Down Expand Up @@ -130,7 +131,8 @@ export class VRMHumanoidRig extends VRMRig {

// Move the mass center of the VRM
if (boneName === 'hips') {
const boneWorldPosition = rigBoneNode.getWorldPosition(new THREE.Vector3());
const boneWorldPosition = rigBoneNode.getWorldPosition(_boneWorldPos);
boneNode.parent!.updateWorldMatrix(true, false);
const parentWorldMatrix = boneNode.parent!.matrixWorld;
const localPosition = boneWorldPosition.applyMatrix4(parentWorldMatrix.invert());
boneNode.position.copy(localPosition);
Expand Down

0 comments on commit 594567d

Please sign in to comment.