Game Development Reference
In-Depth Information
force is a momentum that is applied once, we can use the momentum formula
p=mv
to compute the amount of the force we need to add to the rigid body of the object. This
formula is expressed in line 96. We call
rigidbody.AddForce()
at line 95, which is used to
add a force to the rigid body. After adding the appropriate jump force, we reset
jump
flag
to
false
.
Now we need a script to read the input from the player and call the functions of the character
to control it. This script is
FPSInput
shown in Listing 48.