Wind effect on vrm models #1134
Answered
by
ke456-png
tejasnayak25
asked this question in
Help
-
How do I create wind effect on vrm models? Kindly help |
Beta Was this translation helpful? Give feedback.
Answered by
ke456-png
Dec 14, 2022
Replies: 2 comments 2 replies
-
Overriding the "VRMSpringBoneJointSettings.gravityDir" can be used to create a wind-like effect. const clock = new THREE.Clock();
clock.start();
const windDir = new THREE.Vector3( 0, - 1, - 1 );
const applyWind = ( vrm, t ) => {
const windPower = ( Math.sin( t * Math.PI / 3 ) + 1 ) / 2;
vrm.springBoneManager.joints.forEach( e => {
e.settings.gravityDir = windDir;
e.settings.gravityPower = windPower;
} );
};
function animate() {
requestAnimationFrame( animate );
// update vrm components
if ( currentVrm ) {
applyWind( currentVrm, clock.elapsedTime );
currentVrm.update( clock.getDelta() );
}
// render
renderer.render( scene, camera );
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
tejasnayak25
-
Now, @ke456-png , how do I stop the wind? Please help |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overriding the "VRMSpringBoneJointSettings.gravityDir" can be used to create a wind-like effect.