July 2018
Beginner to intermediate
374 pages
8h 54m
English
Getting the avatar to face the proper direction is fairly easy—especially with all that we already know. Just as we did when we added the walking motion of the hands and feet, we’ll add another function to animate turning our avatar.
Let’s start by going to the list of things that control our avatar.
| | var clock = new THREE.Clock(); |
| | var isCartwheeling = false; |
| | var isFlipping = false; |
| | var isMovingRight = false; |
| | var isMovingLeft = false; |
| | var isMovingForward = false; |
| | var isMovingBack = false; |
At the bottom of that list, add direction and lastDirection.
| | var direction; |
| | var lastDirection; |
We need direction so our code knows which way to turn the avatar. We need lastDirection so the ...
Read now
Unlock full access