Game Development Reference
In-Depth Information
We have already discussed most of the functions in a similar script, which is
FirstPersonCon-
trol
shown in Listing 9. The two scripts handle the camera movement in the same way.
However,
FPSInput
depends on
PhysicsCharacter
, and cannot control the character directly
by displacing it. You can notice the difference between the two scripts in lines 61 through
77 of
FPSInput.
In these lines, we use player input to call functions from
PhysicsCharacter
script, which must be attached to the same object. Before testing your character, it is a good
idea to disable the renderer of the capsule. A complete physics character can be found in
scene17
in the accompanying project. It is worth pointing out that if you add some basic
shapes with rigid bodies and adequate masses, you would be able to push them and move
them using the physics character.