yskang

threejs-minecraft-19

Apr 21st, 2020 (edited)
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. feetAnimate() {
  2.     if( !this.walking ) return;
  3.  
  4.     this.walkOffset += 0.04;
  5.     this.foot1.rotation.x = Math.sin( this.walkOffset ) / 4; // 後腳左
  6.     this.foot2.rotation.x = -Math.sin( this.walkOffset ) / 4; // 前腳左
  7.     this.foot3.rotation.x = -Math.sin( this.walkOffset ) / 4; // 後腳右
  8.     this.foot4.rotation.x = Math.sin( this.walkOffset ) / 4; // 前腳右
  9. }
  10.  
  11. headAnimate() {
  12.     if( !this.headSwinging ) return;
  13.  
  14.     this.rotateHeadOffset += 0.04;
  15.     this.head.rotation.y = Math.sin( this.rotateHeadOffset );
  16. }
Advertisement
Add Comment
Please, Sign In to add comment