# How To Use

{% embed url="https://www.youtube.com/watch?v=C6PmLMTCu7k" %}
hort video tutorial explaining how to implement locomotion using OctoXR
{% endembed %}

### Setting Up

Drag and drop _<mark style="color:blue;">**OctoHand\_Left**</mark>_ and _<mark style="color:blue;">**OctoHand\_Right**</mark>_ prefabs as a child of _<mark style="color:blue;">**TrackingSpace**</mark>_.

Reference (for Oculus) _<mark style="color:blue;">**OVRCameraRig**</mark>_ to _<mark style="color:blue;">**InputRoot**</mark>_ of _<mark style="color:blue;">**MultiSourceInputDataProvider**</mark>_ for each hand.

Drag and drop _Teleport_ prefab as a child of _<mark style="color:blue;">**OctoHand\_Left**</mark>_ or _<mark style="color:blue;">**OctoHand\_Right**</mark>_.

Drag and drop _<mark style="color:blue;">**Footprints**</mark>_ and _<mark style="color:blue;">**Teleport Reticle**</mark>_ prefabs somewhere in the scene hierarchy. Note that you can use your own custom ones.

### Screen Fader

In order to ease the motion sickness caused by immersive VR world, _<mark style="color:blue;">**ScreenFader**</mark>_ was implemented. In the sample scenes, It is mostly used to fade in and out while teleporting (blink teleport) and to fade in when the player is in an uncomfortable situation (perhaps on the edge of the building). Attach it to main camera (in this example _<mark style="color:blue;">**CenterEyeAnchor**</mark>_). Provide it with the material from OctoXR/Materials folder.

![](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2F88sRnACW41jbOQvT9gvQ%2FScreenFader.jpg?alt=media\&token=dbfd7cb3-dfcf-47b1-876b-6a330751ccaa)

### Locomotion System

Attach _<mark style="color:blue;">**LocomotionSystem**</mark>_ component to the _<mark style="color:blue;">**OVRCameraRig**</mark>_. Reference _<mark style="color:blue;">**ScreenFader**</mark>_, _<mark style="color:blue;">**CenterEyeCamera**</mark>_ transform and _<mark style="color:blue;">**Footprints**</mark>_ game object.&#x20;

![](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2FsoHNsDBKfCYHt08Ks7SM%2FLocomotion%20System.jpg?alt=media\&token=b1153f88-da42-423d-ad09-b1050e9f2afe)

### Create Teleport Destinations

There are two types of teleport destinations. _<mark style="color:blue;">**TeleportArea**</mark>_ which represents larger area where player can freely teleport and _<mark style="color:blue;">**TeleportAnchor**</mark>_ where player teleports to the fixed location every time. Add a plane to the scene. Attach it with _<mark style="color:blue;">**TeleportArea**</mark>_ component and _<mark style="color:blue;">**Ground**</mark>_ component. Add another plane to the scene. Scale it down. This time attach it with _<mark style="color:blue;">**TeleportAnchor**</mark>_ component as well as _<mark style="color:blue;">**Ground**</mark>_ component. Planes should look somehow like this now:

![](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2FemcNiVAJA6k2YInlFSYG%2FTeleportArea.jpg?alt=media\&token=bfac96b6-b69f-4186-9379-1fd89f468418)

![](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2FqxaWGgWT2ROSvOKzd546%2FTeleportAnchor.jpg?alt=media\&token=dc3a51f0-09d7-449d-8922-b4c275471141)

### Teleport

There are multiple predefined types of teleport in the OctoXR. Hand tracking teleport and controller tracking teleport. Hand tracking teleport is divided into pinch teleport and custom gesture teleport (Use only one, disable the other). Reference _<mark style="color:blue;">**LocomotionSystem**</mark>_, _<mark style="color:blue;">**BasicHandSkeleton**</mark>, <mark style="color:blue;">**TeleportReticle**</mark>_ and _<mark style="color:blue;">**InputDataProviders**</mark>_ to corresponding hands on elements of _Teleport_ prefab.

![](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2FHpYgLqsVA4OwmWKQCkaS%2FTeleport.jpg?alt=media\&token=cff5a4bf-4fac-40be-926a-38d6f5cb3ee0)

### Results

![Teleport Area Example](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2FYwlMaoEvoSfI5gXnUrit%2FTeleport%20Area%20Example.jpg?alt=media\&token=15045075-c653-4712-8515-5c2e21b4d87c)

![Teleport Anchor Example](https://1600347255-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOWRRl7JoQ9xpVJrphdqz%2Fuploads%2FQvjPXiKHMJsvrbXbNKvG%2FTeleport%20Anchor%20Example.jpg?alt=media\&token=63fb448e-12bd-4324-b001-c67d60f0f3dd)
