General HAP Integration
Last updated
Last updated
If you have your own Character Controller or some 3rd Party Controller from the store you will need to do the following steps:
Add the MRider component to your character.
2. If you are using a CUSTOM Input System you need to connect MRider.MountAnimal()
to your Mount Input and MRider.DismountAnimal()
to your Dismount Input.
If you want to continue using my Malbers Input then use the Context Menu Create Mount Inputs.
This will connect the Inputs automatically with the correct methods.
3. If you are using the Riding for mobile then you need to Set the Event Listeners.. This Events are used on the Mobile UI and Mobile Input to communicate with the Rider in a non dependent way. Do this with the Context menu Create Event Listeners .
This will automatically add the MEvent Listener component with the Events needed for the Rider to communicate with external scripts.
To show the "Press Key to Mount" UI you need to add the Mount UI prefab to any canvas you have on your scene
IMPORTANT:
Is highly recommended to duplicate your Character Animator First before adding the Mounted Layer.
4. Click Add mounted Layer. This will add an extra layer called Mounted and the parameters that the script needs to control the Animator when the character is riding.
The Rider Script must be at the same level as the Animator Component. Otherwise, the Add Mount Layer Button will not appear.
5. On Disable Components add the scripts/components that interfere with the logic while Riding. (Usually is used for scripts that are not supposed to be active/working while the character is Riding. E.g: scripts that move and rotate the character while is on foot, ragdoll, components that you need to be disabled while riding, etc. Also are used to disable Inputs that are only supposed to be active when the character is not riding: E.g: a Crouch Input).
6. Sometimes you will need to disable functions, change variables values when you are Riding the Animal. The best way to solve this is by creating a new Script to communicate between your controller and the Rider Script. You can take full advantage of the Rider Events to let know your character Controller to activate or deactivate behaviours while the character is Mounting or Dismounting the animal. (Ex: Disabling the Crouch Logic of your controller when the rider starts the mount animations; and enabling it back when the character finishes the dismount animations).
And that should be it!.