First Person Exploration Kit: Player Configuration

You can use the included "FPEPlayerController" prefab, or build from scratch using the Unity Standard Asset "First Person Controller".

Table of Contents



Using Included FPEPlayerController prefab (Recommended)

  1. Add some level geometry to your scene for the player to walk on (a plane is fine), and direction light to light the scene.
  2. To use the "FPEPlayerController", just drag an instance of FPECore into your scene.
  3. Run the scene.
  4. You're done.

Refer to the included _GettingStarted.unity scene for an example of this setup.


Building a Player Controller from Scratch

To rebuild using another player controller (such as the Standard Asset version of "First Person Controller"):

  1. Add some level geometry to your scene for the player to walk on (a plane is fine), and direction light to light the scene.
  2. Add an empty game object to your scene, rename if MyCustomFPEPlayerController.
  3. Tag object with tag "Player".
  4. Add a Character Controller, make height 1.8.
  5. Add a RigidBody, and make it Kinematic.
  6. Add an AudioSource, and make Play On Awake false.
  7. Add the FPEPlayer script.
  8. Add the FPEFirstPersonController script (this will automatically add the FPEMouseLook script.
  9. In the Inspector, add the following prefabs (found in the CustomPlayerComponents prefabs sub folder) as children of MyCustomFPEPlayerController:
  10. Add a child Camera object, call it "MainCamera", and ensure that it is tagged as "Main Camera"
  11. Move the MainCamera to position (0, 0.8, 0)
  12. Ensure MainCamera uses Perspective Projection, with Clipping planes of 0.25 for near, and 1000 for far.
  13. In the Inspector, add the following prefabs (found in the CustomPlayerComponents prefabs sub folder) as children of MainCamera:
  14. Set location of MyCustomFPEPlayerController to be (0,1.2,0)
  15. Assign the Footsteps soundbank in the Audio section of the FPEFirstPersonController component in the Inspector.
  16. Assign the Jump and Land sounds in the Audio section of the FPEFirstPersonController component in the Inspector.
  17. Ensure that "Custom Flags for Movement Options" are configured as desired (jump, movement sounds, etc.)
  18. Save MyCustomFPEPlayerController as a prefab in the Prefabs folder.
  19. To ensure it is included as part of the FPECore set, re-assign the "Player Prefab" value to use your new MyCustomFPEPlayerController prefab.
  20. Ensure there is FPECore prefab in your scene.
  21. Run the scene. The player should work as required (same as included FPEPlayerController prefab)

Configuring Other Player Controllers (e.g. Standard Assets, UFPS, etc.)

 While some customers have successfully used 3rd party player controller assets (such as UFPS) with First Person Exploration Kit, they are not officially supported. 

It is possible to port the Interactable functionality to any player controller asset, but it is not a drag and drop exercise. Several functions must changed so that the core of FPEInteractionManagerScript.cs works as expected. All of these functions are contained in the PLAYER_CONTROLLER_SPECIFIC code region inside the FPEInteractionManagerScript.cs file.

Here is a list of the functions that currently allow FPEInteractionManagerScript to control the FPEPlayerController prefab during interactions.

private void rememberStartingMouseSensitivity()This function records our starting sensitivity. The Standard Asset version of the MouseLook script uses X on Character Controller and Y on Camera.
public void refreshAlternateMouseSensitivities()Refreshes alternate (zoomed, etc.) mouse sensitivities.
private void setMouseSensitivity(Vector2 sensitivity)Set sensitivity directly, and ensure smoothMouseChange is off.
private void restorePreviousMouseSensitivity(bool smoothTransition)Restores mouse sensitivity to starting Mouse sensitivity. Vector2 is desired sensitivity. If smoothTransition is true, sensitivity change is gradual. Otherwise, it is changed immediately.
public void changeMouseSensitivityFromMenu(float sensitivity)A hook for a menu or UI to set the mouse sensitivity during the game. Note in this case, both X and Y are set to the same value to simplify the UI. This can be done a different way, respecting X and Y as separate values if desired.
private void disableMouseLook()Locks mouse look, so we can move mouse to rotate objects when examining them. If using another Character Controller (UFPS, etc.) substitute mouselook disable functionality
private void enableMouseLook()Unlocks mouse look so we can move mouse to look when walking/moving normally. If using another Character Controller (UFPS, etc.) substitute mouselook enable functionality
private void disableMovement()Locks movement of Character Controller. If using another Character Controller (UFPS, etc.) substitute disable functionality
private void enableMovement()Unlocks movement of Character Controller. If using another Character Controller (UFPS, etc.) substitute enable functionality
public bool isMouseLookEnabled()Returns mouse look enabled value.
private void DockPlayer(FPEInteractableDockScript dock)Starts docking the player to the specified dock
private void UnDockPlayer(bool smoothDock = false)Starts to Un-Dock the player from their current Dock. Note: converting this function to work with assets such as UFPS may be a non-trivial exercise. See FPEFirstPersonController.cs for details on existing implementation.
private bool dockingCompleted()Checks with player controller to see if dock is currently in progress
public GameObject getCurrentDockForSaveGame()For use by Save Load Manager only.
public void restoreCurrentDockFromSavedGame(GameObject cd)For use by Save Load Manager only.
public void RestrictPlayerLookFromCurrentView(Vector2 angles)Restricts player's look ability to be +/- specified x and y angles, relative to current reticle position.
public void FreePlayerLookFromCurrentViewRestrictions()Removes any existing view restriction on player's view
public void suspendPlayerAndInteraction()This function disables player movement and look, for use by SaveLoadManager or other operation that requires player be 'locked'
public void resumePlayerAndInteraction(bool resetLook)This function enables player movement and look, for use by SaveLoadManager or other operation when it no longer requires player be 'locked'

Once your 3rd party Player Controller code has these functions, you will need to follow "Building a Player Controller from Scratch" above, to ensure the child objects are present (e.g. Examination Camera, toss location, etc., etc.)

Note: Some people have reported a conflict with UFPS zooming and First Person Exploration Kit zooming, but changing a couple of tags (MainCamera, for example) and ensuring the controls for each asset package don't conflict with each other seemed to solve the problem for them. Additionally, if you run into any other issues integrating the two asset packages, I can take a look at your project or code repo and help get things working as expected.