Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
signorpipo authored Mar 13, 2021
1 parent d9afe1f commit e19c81e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ Left gamepad and right gamepad in game are handled differently to showcase diffe
## How to import and use gamepad.js
To import `gamepad.js` you have to:
- Import `gamepad.js` somewhere inside your `project` folder
- Import the `pp` folder into your `project` folder, this folder contains the `pp.js` file with the PP namespace declaration in it
- Import the `pp` folder into your `project` folder, this folder contains the `pp.js` file with the `PP` namespace declaration in it
- This folder should only contain this item
- You must link this folder in the Java Script Sources list (under Project Settings) before any other folders that contain scripts that use the PP namespace
- This is needed to make sure the PP namespace is created before it is used
- If you put it as first (after /js/components/) you should be safe
- If you don't want to use the PP namespace just remove it from the `gamepad.js` script, in this case you won't need `pp.js`
- You must link this folder in the Java Script Sources list (under Project Settings) before any other folders that contain scripts that use the `PP` namespace
- This is needed to make sure the `PP` namespace is created before it is used
- If you put it as first (after `/js/components/`) you should be safe
- If you don't want to use the `PP` namespace just remove it from the `gamepad.js` script, in this case you won't need `pp.js`

To use `gamepad.js` you have to:
- Instantiate the Gamepad class for both left and right controller
- You can instatiate them as global variable, singleton, and so on, as long as you can retrieve them
- Call start and update on it
- You could import `gamepads_manager_component.js` component and add it to the Player object to have a simple way to instantiate/start/update the gamepads
- In this case LeftGamepad and RightGamepad will be global variables
- In this case `PP.LeftGamepad` and `PP.RightGamepad` will be global variables

At this point you can:
- Register/unregister to buttons and axes events
Expand All @@ -32,9 +32,9 @@ At this point you can:
If you want to import the gamepad models with the animation of the buttons you have to:
- Import `gamepad.js` as shown above
- Import `gamepad_animator.js`
- Inside `gamepad_animator.js` you can search for @EDIT tags where you can/have to make modifications
- Inside `gamepad_animator.js` you can search for `@EDIT` tags where you can/have to make modifications
- You have to specify how to retrieve the left and right gamepad instances
- If you are using the `gamepads_manager_component.js` component you just have to specify LeftGamepad or RightGamepad
- If you are using the `gamepads_manager_component.js` component you just have to specify `PP.LeftGamepad` or `PP.RightGamepad`
- You can also specify different colors for normal/touched button state, null means the colors will not be changed
- Import the `quest_controllers_credits_Jezza3D.glb` model inside your `project` folder
- Drag and drop the model on the Player object
Expand Down

0 comments on commit e19c81e

Please sign in to comment.