-
Notifications
You must be signed in to change notification settings - Fork 102
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
Adjust animation with reference to hips height #1074
Conversation
Adjust with reference to waist height VRMのhipsの高さとmixamoのFBXのhipsのYの比によって、 hipsの位置のアニメーションの値を変更します。 これによって、足の長いVRMや短いVRMでも地面に足がついた状態でアニメーションするようになります。
const motionHipsHeight = asset.getObjectByName( 'mixamorigHips' ).position.y; | ||
const vrmHipsY = vrm.humanoid?.getNormalizedBoneNode( 'hips' ).getWorldPosition( _vec3 ).y; | ||
const vrmRootY = vrm.scene.getWorldPosition( _vec3 ).y; | ||
const vrmHipsHeight = Math.abs( vrmHipsY - vrmRootY ); | ||
const hipsPositionScale = vrmHipsHeight / motionHipsHeight; |
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.
VRMは位置を変更している可能性があるためvrm.sceneとの差をとっています。
mixamoのFBXからはy座標をそのままとっています。
|
||
tracks.push( new THREE.VectorKeyframeTrack( `${nodeName}.${propertyName}`, track.times, value ) ); | ||
const value = track.values.map( ( v, i ) => ( vrm.meta?.metaVersion === '0' && i % 3 !== 1 ? - v : v ) * hipsPositionScale ); | ||
tracks.push( new THREE.VectorKeyframeTrack( `${vrmNodeName}.${propertyName}`, track.times, value ) ); |
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.
ここの nodeName
の変更はシンプルにわざわざ別変数にする意味がなかったということですかね
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.
はい、その通りです
コード見る感じ良さそうです。動作確認してみます |
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.
動作も良好。good
Description
examples/humanoidAniamtion でVRMごとの身長差を考慮するように修正します
VRMのhipsの高さとmixamoのFBXのhipsのYの比によって、
hipsの位置のアニメーションの値を変更します。
これによって、足の長いVRMや短いVRMでも地面に足がついた状態でアニメーションするようになります。