# Getting Started

The Ultimate Joystick is designed to be as simple and easy to use as possible. You will only need a few lines of code in order to get the Ultimate Joystick working inside your project.

To begin we'll look at how to simply create an Ultimate Joystick in your scene. After that we will go over how to reference the Ultimate Joystick in your custom scripts. Let's begin!

## How to Create

To create an Ultimate Joystick in your scene, simply find the Ultimate Joystick prefab that you would like to add and drag the prefab into your scene. It should automatically set itself as a child of a UI Canvas, or create one if necessary.

{% hint style="info" %}
Prefabs can be found at: *Assets/Tank & Healer Studio/Ultimate Joystick/Prefabs*
{% endhint %}

## How to Reference

One of the great things about the Ultimate Joystick is how easy it is to reference to other scripts. The first thing that you will want to make sure to do is to name the joystick in the Script Reference section. After this is complete, you will be able to reference that particular joystick by the name that you have assigned to it.

After the joystick has been given a name in the Script Reference section, we can get that joystick's position by catching the Horizontal and Vertical values at run time and storing the results from the static functions: *GetHorizontalAxis* and *GetVerticalAxis*. These functions will return the joystick's position, and will be float values between -1, and 1, with 0 being at the center. For more information about these functions, and others that are available to the Ultimate Joystick class, please see the Documentation section of this window.

{% hint style="info" %}
**New Input System:** In order to reference the Ultimate Joystick with the new Input System from Unity, simply go to the Script Reference section of the Ultimate Joystick in your scene and set the Control Path variable to the desired path.
{% endhint %}

For a full list of the functions available, please see the [Documention](/assets/ultimatejoystick/documentation/ultimatejoystick.md) section.

### Simple Example

Let's assume that we want to use a joystick for a characters movement. The first thing to do is to assign the name "Movement" in the Joystick Name variable located in the Script Reference section of the Ultimate Joystick.

<figure><img src="/files/xvjuNieofhIhWuiX7nZK" alt=""><figcaption></figcaption></figure>

After that, we need to create two float variables to store the result of the joystick's position. In order to get the "Movement" joystick's position, we need to pass in the name "Movement" as the argument.

```csharp
float h = UltimateJoystick.GetHorizontalAxis( "Movement" );
float v = UltimateJoystick.GetVerticalAxis( "Movement" );
```

The h and v variables now contain the values of the Movement joystick's position. Now we can use this information in any way that is desired. For example, if you are wanting to put the joystick's position into a character movement script, you would create a Vector3 variable for movement direction, and put in the appropriate values of this joystick's position.

```csharp
Vector3 movementDirection = new Vector3( h, 0, v );
```

In the above example, the h variable is used to in the X slot of the Vector3, and the v variable is in the Z slot. This is because you generally don't want your character to move in the Y direction unless the user jumps. That is why we put the v variable into the Z value of the movementDirection variable.

Understanding how to use the values from any input is important when creating character controllers, so experiment with the values and try to understand how user input can be used in different ways.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tankandhealerstudio.com/assets/ultimatejoystick/introduction/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
