Game Development Reference
In-Depth Information
{
this.transform.position - = this.transform.forward * speed;
}
}
FIG 3.9 A capsule collider around an
animated character.
Step 9. Play. The up and down arrow keys will move the character
forward and backward. However, the backward animation will look
strange as it is still applying the walking forward cycle. If the character
seems to be skating across the ground, change the speed until it looks
better. If the character is floating a little above the ground, move the
capsule collider up a bit so that the feet of the model fall and touch
the ground.
Step 10. To add in a forward, backward, and idle animation for the
different states of the character, modify animationControls.js to the
code in Listing 3.10 .
Step 11. Play. The character will have a more natural movement
when going backward and will stand still when the arrow keys are
not pressed. The only problem now is that the start and end frames of
the idle animation do not match well with the forward and backward
start and end frames. To overcome this, the idle animation could be
Search Nedrilad ::




Custom Search