Add new input device¶
Through the MAGESControls configuration which utilizes the Unity’s Input System, it is possible to add new input devices and their controls to your MAGES NXT project.
In this tutorial we are going to create new keyboard controls for the movement of the player’s avatar.
Note
Make sure to connect your new device to your laptop/PC
Open the MAGESControls.inputactions asset. You can now see the different Action Maps and their Actions on screen, which represent the different actions that can be performed through user input. For more information regarding the MAGESControls configurations you can check out the MAGES Controls manual here.
Click on the LeftHandLocomotion Action Map then, click on the button on the Move Action and select Add Left/Right/Up/Down Composite. Name the new Composite accordingly.
Click on the Up Binding and on the Binding Properties Click on the Path option dropdown and navigate to
Keyboard
> By Location of Key (Using US Layout) > W.Repeat Step 3 to assign the Down, Left and Right Bindings with the S, A and D keys accordingly. Now the avatar can move horizontally according to the keys assigned.
Click on the RightHandLocomotion Action Map then click on the button on the Change Height Action and select Add Positive/Negative Binding. Name the new Binding accordingly.
Click on the Negative Binding and like steps 3 and 4, assign it to the Q key.
Repeat step 6 to assign the Positive Binding with the E key. Now the avatar can move vertically according to the keys assigned.
Congratulations, you have successfully modified the movement of the player in your MAGES project.
Note
The new added controls work in both camera settings (Mobile 3D or XR Devices), as long as the input device is connected to the device running the operation.