# Guided Transport

TransportSurfaces are ideal for modeling standard conveyor systems. However, for rail-based systems or systems with numerous colliders for making curves, stable modeling may not be achievable using TransportSurfaces. As an example, please check the following system, where the MUs are moving in a stable manner on the conveyor system. MUs can also be stopped by physical stoppers (based on colliders).

> 💡 **Note**:\
> If your transport surface is **position-controlled** (e.g., updated by a PLC), using standard `GuidedMU` may lead to physics instability.\
> In such cases, switch to a **kinematic approach** using `KinematicMU` for smooth and reliable transport.\
> See [KinematicMU ](https://doc.realvirtual.io/components-and-scripts/motion/kinematicmu-pro)for setup and usage details.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-bfae071b8cce4f11493b1193071d094c1eec3824%2Fvlc_ninZK3Lt2c.gif?alt=media" alt=""><figcaption></figcaption></figure>

In such cases, Guided Transports come to the rescue. They offer limited transport direction and position, following guide lines that can be linear or circular.

There are two options for using Guided Transports. First, you can make Guided Transports children of TransportSurfaces by adding GuideLines or GuideCircles. This allows you to retain the standard animation features of the surface itself.

Alternatively, you can use the TransportGuided Prefab, which combines a drive, the necessary GuideLine or GuideCircle, and all required colliders in a single component. This is especially useful for overlaying on an existing imported CAD Design.

You can find a tutorial about Guided Transports on Youtube:

{% embed url="<https://youtu.be/9xlYGXN2AEA?si=aqn3tLuBdbh2ewR9>" %}
Guilded Transport Tutorial
{% endembed %}

## Demo Scene

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-0bb0945335cd311f8f9a3baef6de54943d052b7f%2FGuidedTransportDemo.gif?alt=media" alt=""><figcaption><p>Demo Scene</p></figcaption></figure>

A special demo scene showcases various demonstrations of guided transports, including lifting objects using Guide Transports, such as chain systems. You can access this demo scene through the main menu by navigating to `Tools > realvirtual > Additional Demos > Guided Transport`. Explore the different scenarios to see the capabilities and applications of Guided Transports in action.

## Prerequisites - GuidedMU

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-7611251aebba6da3f0563ec3449c0e6839ffc420%2FGuidedTransportMU.png?alt=media" alt=""><figcaption><p>GuidedMU</p></figcaption></figure>

To utilize Guided Transport, you must ensure that all [MUs ](https://doc.realvirtual.io/components-and-scripts/mu-movable-unit)(Moving Units) have a `GuideMU` script attached to them. The recommended approach is to add this script to the [Source](https://doc.realvirtual.io/components-and-scripts/mu-movable-unit/source), as shown in the picture.

Guided Transports rely on colliders and raycasts to detect the Guide Lines. Therefore, it's necessary to define the raycast length and layers appropriately to ensure proper functionality.

{% hint style="info" %}
The raycast in the Guided Transport system will always be performed downwards in the Global Z direction. This ensures that even Moving Units (MUs) that may be tumbling or moving erratically will still be able to detect the colliders accurately and be snapped to the Guide Lines.
{% endhint %}

The standard components used in Guided Transport are `rvTransport`, which combines Guide Lines with [TransportSurfaces](https://doc.realvirtual.io/components-and-scripts/motion/transportsurface), and `rvSimStatic`, which is utilized for TransportGuided Components. The `rvSimStatic` component is especially useful when you want to avoid collisions with the [MUs ](https://doc.realvirtual.io/components-and-scripts/mu-movable-unit)detected by the detection collider.

## Guided Transport with TransportSurface

`TransportSurfaces` can be extended by GuideLines. This will snap MUs as soon as the `GuidedMU` raycast are detecting the `TransportSurface`. The MU is always aligned and snapped to the nearest point on the `TransportSurface`. The speed is taken from the `TransportSurface`. You need just to add an empty Gameobject underneath the `TransportSurface` and add the `GuideLine` or `GuideCircle` component to it. Alternatively you can use the overlay menu or the main menu (e.g. `Tools > realvirtual > Add Object > GuideLine`)

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-468fd52d1535152982d1edde58790355c589f936%2FGuidedTransportGuideLine.png?alt=media" alt=""><figcaption><p>GuideLine as children under a TransportSurface</p></figcaption></figure>

Besides the GuideLine also GuideCircle is available for circular movements.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-1e6c96d2f9c97d7145e3bd33515daa2e7c0f3b40%2FGuidedTransportGuideCircle.png?alt=media" alt=""><figcaption><p>GuideLine as children under a TransportSurface</p></figcaption></figure>

## TransportGuided

A convenient alternative for implementing Guided Transport is to use the `TransportGuided` Component. This single Prefab component simplifies the process by combining a Drive and the `TransportGuided` script into one entity. Additionally, it automatically creates the necessary colliders and either a `GuideCircle` or *GuideLine*, depending on the configuration.

To add a TransportGuided component:

1. Drag and drop the prefab into the scene, or
2. Use the main menu: Tools > realvirtual > Add Object > TransportGuided, or
3. Use the overlay menu.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-d9ff0b37a10bccf8176362afc4f93215546249f4%2FTransportGuided.png?alt=media" alt=""><figcaption><p>TransportGuided Circular</p></figcaption></figure>

### Properties

#### Circular

True for circular guide lines.

#### Radius (Circular)

The radius of the guide line.

#### Angle (Circular)

The angle of the guide line.

#### Collider Border Z (Circular)

The border in Z direction to the side on the entry of the guide line.

#### Collider Border X (Circular)

The border in X direction to the side on the exit of the guide line.

#### Length (Linear)

The length of the linear guide line.

#### Height

The height of the component. Zero Point of the component is always the start of the guide line or guide circle.

#### Width (Linear)

The width of the collider for linear guide lines.

#### DistanceCollider

The distance between the collider and the guide line. The collider should be always a little bit underneath the guide line.

#### ShowGizmos

True if the Gizmos for the collider and guide lines should be shown.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-47f1aa66b01e14a3e86bd0310dc49d50ebfcd80b%2FTransportGuidedLine.png?alt=media" alt=""><figcaption><p>TransportGuidedLinear</p></figcaption></figure>
