We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A glitch occurs when playing an animation file downloaded from Mixamo.
The animation plays smoothly without any glitch.
Glitches occur in some cases.
The glitch does not occur when I modify the code as follows (VRMAnimation.ts):
- const track = new THREE.VectorKeyframeTrack( - `${nodeName}.quaternion`, - origTrack.times, - origTrack.values.map((v, i) => - metaVersion === "0" && i % 2 === 0 ? -v : v - ) - ); + const newValues: number[] = []; + const metaVersionZero = metaVersion === "0"; + let sign = metaVersionZero ? -1 : 1; + let opposite = metaVersionZero ? 1 : 1; + let prevQuaternion = new THREE.Quaternion(); + + if (origTrack.values.length % 4 !== 0) { + throw new Error("Invalid origTrack values length"); + } + + for (let i = 0; i < origTrack.values.length; i += 4) { + const quaternion = new THREE.Quaternion( + origTrack.values[i], + origTrack.values[i + 1], + origTrack.values[i + 2], + origTrack.values[i + 3] + ); + if (prevQuaternion.dot(quaternion) < 0 && metaVersionZero) { + sign *= -1; + opposite *= -1; + } + newValues.push( + sign * origTrack.values[i], + opposite * origTrack.values[i + 1], + sign * origTrack.values[i + 2], + opposite * origTrack.values[i + 3] + ); + prevQuaternion = quaternion; + } + const track = origTrack.clone(); + track.values = new Float32Array(newValues); + track.name = `${nodeName}.quaternion`;
Before:
After:
I'm not very familiar with 3D graphics, so I apologize if my corrections are not accurate. Please consider them as references only 😂
The text was updated successfully, but these errors were encountered:
Do you have a gist of the file you used to play the glb? Did you simply update the VRMAnimation.ts file? It's very cool what you have!
Sorry, something went wrong.
Did you simply update the VRMAnimation.ts file?
Yes, that's all I've done!
FYI: I wrote a blog post about it, so it might be helpful for you. https://qiita.com/galpro/items/bdc2bdcbd6f4cf99e157
get fix for animations from pixiv/ChatVRM#9
f6d7413
75f65e3
No branches or pull requests
Problem
A glitch occurs when playing an animation file downloaded from Mixamo.
Steps to reproduce
Expected result
The animation plays smoothly without any glitch.
Actual result
Glitches occur in some cases.
Possible solution
The glitch does not occur when I modify the code as follows (VRMAnimation.ts):
Before:
before.mov
After:
after.mov
I'm not very familiar with 3D graphics, so I apologize if my corrections are not accurate. Please consider them as references only 😂
The text was updated successfully, but these errors were encountered: