> For the complete documentation index, see [llms.txt](https://julhiecio.gitbook.io/ju-tps-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://julhiecio.gitbook.io/ju-tps-documentation/game-development/how-to-use-vehicle-system/how-to-create-a-motorcycle-controller.md).

# How to create a Motorcycle Controller

## Vehicle First Steps&#x20;

1- Place motorcycle model in the scene, set layer of car to **Vehicle**(8) and Unpack Prefab

2- Add <mark style="color:green;">Colliders</mark> and <mark style="color:green;">Rigidbody</mark> (set a high value for the mass of the vehicle, like <mark style="color:red;">100</mark>)

3- Create Wheel Colliders for each wheel model

4- Add **Motorcycle Controller component** and assign <mark style="color:blue;">wheel models</mark> and <mark style="color:green;">wheel colliders</mark> in same sequence:

5- Assign Steering Wheel

6- Set the Center of Mass

7- Create a vehicle enter trigger

8- Create and assign **Inverse Kinematic Target Positions**

{% hint style="info" %}
The above steps are the same as the [car setup](/ju-tps-documentation/game-development/how-to-use-vehicle-system/how-to-create-a-car-controller.md), see the [page ](/ju-tps-documentation/game-development/how-to-use-vehicle-system/how-to-create-a-car-controller.md)for more details
{% endhint %}

<figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FYQMyiupM1Bjqs4eodyll%2FScreenshot%20from%202024-03-20%2020-51-25.png?alt=media&amp;token=1c64871d-8612-456e-8646-e6c882583b97" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Tip: if you place the center of mass at the height of the wheels and further back, as in the image above, you will get good results
{% endhint %}

## Motorcycle Parameters

Motorbike physics has some unique parameters:

<div align="left"><figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FlvRqHO41TAdkObrBmrNB%2FScreenshot%20from%202024-03-20%2020-52-44.png?alt=media&amp;token=b76a47c6-21a9-47a5-a6aa-a4885a803e34" alt=""><figcaption></figcaption></figure></div>

<table><thead><tr><th width="248">Wheels</th><th>Description</th></tr></thead><tbody><tr><td></td><td></td></tr><tr><td>Max Steer Angle</td><td>The max wheel steer angle</td></tr><tr><td>Throttle intensity</td><td>Wheel acceleration influence by the engine.</td></tr><tr><td>Brake Intensity</td><td>The brake force intensity influence by the engine settings.</td></tr><tr><td>Wheel Collider</td><td>The wheel collider.</td></tr><tr><td>Wheel mesh</td><td>The wheel model.</td></tr></tbody></table>

| Inclination         | Description                                                                        |
| ------------------- | ---------------------------------------------------------------------------------- |
| Sensitive           | The sensitive to start lean on curves.                                             |
| Speed               | The speed to lean the motorcycle in curves.                                        |
| Max Angle           | Maximum angle the motorcycle can lean in motion.                                   |
| Stopped Inclination | The angle of the wheel when stopped, used to simulate the driver's feet on ground. |
| On Grounded Drag    | Motorcycle drag when on ground.                                                    |
| Off Ground Drag     | Motorcycle drag when not grounded.                                                 |

| Loop                  | Description                                                                                                                                                                                                                  |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enable Looping        | Enable loop system                                                                                                                                                                                                           |
| Loop Tag              | <p>Loop tag.</p><p><mark style="color:blue;">⚠</mark> <mark style="color:blue;">when the bike passes through an object with this tag the motorcycle lean system will be turned off to complete the loop correctly</mark></p> |
| Align With Loop Speed | The speed to align the Up with the loop normal.                                                                                                                                                                              |

[Overturn Check](/ju-tps-documentation/game-development/how-to-use-vehicle-system/standard-vehicle-configuration.md#anti-overturn-checker-parameters) is the same for any vehicle.

## Motorcycle Suspension

Up to this point the bike will be working normally, however it is interesting to use a suspension script:

<figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2Ff0XOqwbbeyGtbwaQIBDA%2Fimage.png?alt=media&amp;token=6445c68e-7760-4763-8dbf-36ab5d335d2c" alt=""><figcaption></figcaption></figure>

### Result

<div align="center"><figure><img src="https://2945806600-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCQMDx0LmgnRXXTklLhoh%2Fuploads%2FOujgM59yYUq3EdPQpb75%2FMotorcycle.gif?alt=media&amp;token=63c68fd8-f852-479d-8e17-d9562cde25f2" alt=""><figcaption></figcaption></figure></div>
