# Connection Types

{% content-ref url="towing-vehicle-setup" %}
[towing-vehicle-setup](https://distubredone322.gitbook.io/custom-vehicle-controller/guides/trailer-system/towing-vehicle-setup)
{% endcontent-ref %}

A hitch connector has 2 possible ways to connect.

1. Using player input
2. Using collisions

You can select any or both of the methods on the component itself.

<figure><img src="https://3780384024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVPyvySfaC85jUgVcDPRJ%2Fuploads%2FcbX154PozZExExFgdnNx%2Fimage.png?alt=media&#x26;token=d8ef82ef-c36d-47eb-a06c-5324671b5407" alt=""><figcaption></figcaption></figure>

### Player Input

Player Input relies on a single property - "SearchRadius".

<figure><img src="https://3780384024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVPyvySfaC85jUgVcDPRJ%2Fuploads%2F9ti5Vll3sTVNe7Onjj63%2Fimage.png?alt=media&#x26;token=02c00ef2-4750-40b7-bf09-0c431b89b8eb" alt=""><figcaption></figcaption></figure>

Search radius defines two things:

1. The radius of the OverlapSphere. Upon user action, the hitch (if unconnected), will try to find the TrailerController the radius around it.&#x20;
2. <mark style="color:red;">The maximum possible distance</mark> between this hitch and <mark style="color:red;">the coupler on the trailer</mark> for a viable connection.

Meaning, for a successful connection, the hitch must find a TrailerController near self and it's coupler must be close enough.

{% hint style="info" %}
The user action for connecting a trailer is handled like a toggle for a connection - try connect if not connected / disconnect if connected
{% endhint %}

### Collision

If the connection type is set to "Collision" or "Both", the connection will occur automatically upon collision with a TrailerController.

{% hint style="info" %}
"SearchRadius" is still used to make sure the hitch and coupler are near each other.
{% endhint %}

The tow hitch connector doesn't have a way to disconnect from the trailer. However, it has a condition for a new connection.

<figure><img src="https://3780384024-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVPyvySfaC85jUgVcDPRJ%2Fuploads%2FUMnjcD66jny45e24qiKJ%2Fimage.png?alt=media&#x26;token=5df6645d-baec-4a17-bc50-1d5548a5e037" alt=""><figcaption></figcaption></figure>

After disconnecting from the trailer, another connection becomes possible only after gaining "Reconnect Min Dist" distance from the last trailer's coupler point.&#x20;

{% hint style="info" %}
Similar to the "SearchRadius", the size of the collider it this case influeces the chances of connection. For sphere collider, you can (and probably should) set the radius to the same value.
{% endhint %}
