🏇MRider

Las Update: Version 4.4.5

Overview

This component manages the Riding Logic of the humanoid character

The Character needs to be rigged as a Humanoid in order to share the riding animations

Requirements

The component uses a specific Animator Layer that has all the animations needed to synchronize the Rider and Horse Animations. This is solved by using the button [Add Mount Layer]

How it works

When the character interacts with any Mount Trigger it will notify the Rider component that an Animal can be mounted, and it will execute all the Mount Logic to mount the animal.

General

Start Mounted

If enabled, the Rider will already be mounted on the Stored Mount.

Stored Mount

Reference to an animal that can be mounted (That has the Mount Component). This feature is used in conjunction with the Start Mounted option.

It is also used with the Call animal feature. When using the method CallAnimal.. it will use the reference of the stored mount.

Mount Conditions

Extra Mount conditions to check if Mounting an animal can be executed (Condition Dynamic Target: The Mount)

E.g., The Rider is not allowed to mount if it's climbing a ladder or if it's inside any zone.

Dismount Conditions

Extra Dismount conditions to check if dismounting an animal can be executed (Condition Dynamic Target: The Mount)


Parent to Mount

When mounting the Animal, the rider will be parent to the Mount -> MountPoint transform.

Update Type

If Parent to mount is false. Use instead any Unity Cycle to Reposition and Orient the Rider to the Mount point when the rider is not parented to the horse.

Dismount Type

Changes what Dismount animations will be used.

  • Random - It will use a random Mount Trigger of the Mount

  • Mount Input - Use the Rider Input Horizontal or Vertical to Dismount the animal. E.g., if you press Left while dismounting, it will dismount on the Left side

  • Last - Use for dismounting, the same Mount Trigger used for mounting

  • Rider Input -? it was the same as Mount Input (Removed)

Gravity

Gravity Direction. This is used to properly orient the Rider back to the ground's Normal direction when dismounting. E.g., when the Animal is on a Slope or when the gravity direction has changed.


Kinematic Rider

When the Rider is mounting the animal. The rigidbody will be set as kinematic, which will avoid the Rider collider from pushing the horse's colliders.

Main Collider

Reference to the rider's main collider

Collider Modifier

Changes properties of the Main Capsule collider, so it can be adjusted better when mounting

Internal Colliders

Store all the internal colliders the character may have, like colliders in the spine and the head. This is used internally to avoid issues with unwanted collider behaviors.

Tip: You can right-click on the List to find the internal colliders automatically


Rider Hands (Left and Right)

Reference for the hands transforms. This is used to parent the Reins onto the respective hands

Rein Offsets (Left and Right)

Offset to position the Rein points correctly on the Rider's Hands


Exposed Values

These exposed values can be used with scriptable variables, so they can be accessed anywhere

Can Mount

The rider can mount an animal

Can Dismount

The rider can dismount an animal

Can Call Mount

The rider can call a mount


Call Mount Section

All these parameters are related to calling a horse from afar. The horse must have an AI component

Call Mount Layer Ground

Layer to find the ground and teleport the horse when it is too far away

Call Radius

When the horse is in a distance farther away from this value, then it will be teleported back near the rider

Teleport Distance

When the animal is teleported, it will be at a distance (this value) near the rider

Teleport Height

Ray Height to find obstacles when casting a ray down to avoid teleporting the horse inside any obstacle

Call Animal (Audio)

Reference for the call animal audio clip

Stop Animal (Audio)

Reference for the stop animal audio clip

Audio Source

Reference for the source component to play Call or Stop animal sounds


Disable Components & Disable List

Use it to disable components that are interfering with the riding logic.

Add the scripts that interfere with the logic while riding. (is usually used for scripts that are not supposed to be active while the character is riding. Like scripts that move and rotate the character, Ragdoll scripts, etc. Also, they are used to disable Inputs that are only supposed to be active when the character is not riding: E.g.: a Crouch Input.

It is always recommended to disable features inside the components that break the riding logic, using a Link custom Script, instead of disabling the components completely. E.g. for Invector Integration, I've created a custom link script to disable internally via script mechanics that interfere with the riding mechanic


Events

On Start Mounting

Invoked when the Rider starts mounting the animal

On End Mounting

Invoked when the Rider starts mounting the animal

On Star Mounting

Invoked when the Rider starts mounting the animal

On End Dismounting

Invoked when the Rider starts mounting the animal

On Can Mount (Boolean)

Invoked when the Rider can mount an animal (when is inside any Mount Triggers)

On Can Dismount (Boolean)

Invoked when the Rider can start dismounting an animal.

On Find Mount (GameObject)

Invoked when the Rider has found a Mount. When a value is stored in the value StoredMount

Can Call Mount (Boolean)

Invoked when the Rider can call a mount.

Advanced

Animator

Reference for the Animator component

Rigid Body

Reference for the Rigid body component

Rider's Root

Reference for the Rider Root GameObject

ReSync

Enables the re-synchronization feature

Sync Modes

Sync the Modes from the Rider in case the Ride is using Animal Controller. Sync (Attacks, Damage)

Resync Threshold

If the Mount and the Rider have a difference on the Animator greater than this value, it will force a resync

Align MTrigger Time

Time to Align to the Mount Trigger Position while is playing the Mount Animation

Debug

When the Editor is in Play Mode, it displays the values of internal private variables.

Enable Debug on the Rider component and 2 spheres gizmos (1 red and 1 green) will appear on the Head of the Rider to see if the Animal and Rider Animations are in Sync.

Last updated

Was this helpful?