# Transitions and Waypoints

Let's create transition to that tree! First we start from easy one - teleporting.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FziQuaRo0hlQeAb9yal3t%2Fimage.png?alt=media&#x26;token=14e6fc63-28ef-45d1-b7f0-23223ee8a20a" alt=""><figcaption><p>We want to transition to this tree</p></figcaption></figure>

First - create transition zone, go to ZONES/ folder and drag transition\_zone.tscn to the scene.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FhvuN9lgjkgTMc3SOfKbQ%2Fimage.png?alt=media&#x26;token=c9d149ca-2a60-4293-b1be-e2f4a7ce3222" alt=""><figcaption></figcaption></figure>

Then go to HELPERS/ folder and drag transition\_target.tscn to the level.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2Fv2NoiPDvEanin0WyIJxS%2Fimage.png?alt=media&#x26;token=75f84202-6a42-41c8-989e-31160aaf0caa" alt=""><figcaption><p>Helper - 3D Arrow for player's future position and rotation</p></figcaption></figure>

This helper will be our spawn point when we use transition zone. Let's set transition\_zone parameters inside inspector in Keys.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2Fbaq7YjvIG8ybHZSVPnxl%2Fimage.png?alt=media&#x26;token=7a9f201e-bb42-41d5-b447-d4bd8c69f56d" alt=""><figcaption></figcaption></figure>

Basic transition zone has:

**last\_point\_is\_end** - used only with waypoints, last point will be the same as target\_object

**name** - must have unique name for scripts

**target\_object** - name of our helper, will teleport player to target position <mark style="color:red;">\*can't be empty</mark>

**waypoints** - play walking animation between points and then at the last point teleport player to target position <mark style="color:red;">\*if empty - only teleport to target</mark>

Let's rename our target helper to "tree\_target"

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FkEIru9POUKYgrha83x8l%2Fimage.png?alt=media&#x26;token=a1e1d6e5-551b-4531-abfd-5a977dca35ee" alt=""><figcaption></figcaption></figure>

Set same name to **target\_object** in transition\_zone Keys.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2Fpwn6vv7FddrFyqTZbtbA%2Fimage.png?alt=media&#x26;token=bf0ce435-1396-4d4c-8b7b-4af48971829f" alt=""><figcaption></figcaption></figure>

Let's test. We teleported to the helper and looked at the same direction that the arrow is looking.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FDFaxRyYayxSIbuUafgkk%2Fimage.png?alt=media&#x26;token=ef589ed0-1e31-40b5-8479-f314afec1405" alt=""><figcaption></figcaption></figure>

But let's make it difficult - create some waypoints path.

Click Right mouse button on the level root node and select Add Child Node...

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FIkEDhAof3TbkIubmcMT6%2Fimage.png?alt=media&#x26;token=cc09160e-6300-4a51-8e37-38734fc1016b" alt=""><figcaption></figcaption></figure>

Search for the Path3D.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FAKZLI6Bs96e9aLNYVItO%2Fimage.png?alt=media&#x26;token=0ec5de69-e215-4ee5-bec9-67f1bff892df" alt=""><figcaption></figcaption></figure>

Click create.&#x20;

{% hint style="warning" %}
Do not move it from zero XYZ position.
{% endhint %}

When Path3D is selected you'll see that you have new tools at toolbar at right top corner.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FkZc4vGG6MbtUGnh90DAJ%2Fimage.png?alt=media&#x26;token=642d7f81-a835-4af7-9bf1-10e2164ae361" alt=""><figcaption><p>New path3D tools</p></figcaption></figure>

{% hint style="info" %}
First - select point\
Second - Select control point\
Third - Add point\
Fourth - Delete point\
Fifth - Close curve
{% endhint %}

Create first point. with Third button on toolbar (green plus sign with green dot). Also don't forget to switch to top view.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F9w0NjrkOAvUUp67W8OWa%2Fimage.png?alt=media&#x26;token=21f0b164-8ad9-4b67-b954-15f76d8339dd" alt=""><figcaption><p>Top view. Can be switched by clicking on X Y or Z at the right top corner.</p></figcaption></figure>

And put first point.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F8W2VU1vnPjNn1P4QCzY6%2Fimage.png?alt=media&#x26;token=a3a7284f-0f8e-46ef-ad6f-0eec6f59c060" alt=""><figcaption></figcaption></figure>

Then go to the inspector and open Curve parameter. Select Points group.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FXJph7pQtkk8ItzRNkiKp%2Fimage.png?alt=media&#x26;token=2d3fb5f2-ffd9-4506-9d2d-8fe32597ca60" alt=""><figcaption></figcaption></figure>

Set Y to 1.7, so the next new points will be at the same height.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FKpHpmjSmJ2bYgL83rKRV%2Fimage.png?alt=media&#x26;token=c2d83f57-9af5-4e2e-a61f-f3432020c55c" alt=""><figcaption></figcaption></figure>

Now draw click new point and place the last one close to helper target.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FnH76c8qz4kGNPTsUjX5Q%2Fimage.png?alt=media&#x26;token=1fa3a9cd-11c1-4d3d-baea-cef6e164ea51" alt=""><figcaption><p>Waypoints</p></figcaption></figure>

Okay, lets name our Path3D with unique name and put same name intro transition\_zone Keys.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FHHu2BTcWyUQkYqGS4dEy%2Fimage.png?alt=media&#x26;token=0197b710-733c-494d-84f1-23d3e15a5bbb" alt=""><figcaption><p>Rename Path3D</p></figcaption></figure>

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2Fv8Lqlwuz3LQIBzutg1NN%2Fimage.png?alt=media&#x26;token=37994c38-3582-4d3b-8d75-ad1db22c76e6" alt=""><figcaption><p>Set waypoints key with Path3D name</p></figcaption></figure>

Lets test! See, now player walk with these points right into target.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F8pq4gBT0QYqWnn4IrPHX%2Fimage.png?alt=media&#x26;token=1a64a9c5-d774-4598-a8a1-4a9a07f85db8" alt=""><figcaption></figcaption></figure>

Hey, let's delete target helper and will try to make last point of waypoint ours target!

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2Fc1S5hqFrf9qSGHWbYbAy%2Fimage.png?alt=media&#x26;token=2fc2343b-88ab-4965-a791-7f0ebb6eb841" alt=""><figcaption></figcaption></figure>

Keep waypoints name, but delete target\_object and turn on last\_point\_is\_end.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FmQGEeuB3QAqkgl0qfjAK%2Fimage.png?alt=media&#x26;token=968ca37e-bf1b-49b9-9743-08fff5dc1314" alt=""><figcaption></figcaption></figure>

Now, let's make transition trigger with level change function! You can do it in a few ways - manual or using prefab. Let's talk about a manual option.

Select transition zone on the current level and change its "id" from "transition" to "transition\_to\_level" and add a new String key "level" with String value of target level ID. For example - let's set "intro" level from res://assets/levels/

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F705yBSxCR1CtUEhnSMLA%2Fimage.png?alt=media&#x26;token=d5a7de8d-9876-4029-a045-46fff893d0ca" alt=""><figcaption></figcaption></figure>

As you can see, after we reach last point of waypoint - we load new level.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2FmewYLiOpyTvHOMsrXFok%2Fimage.png?alt=media&#x26;token=f286b5d6-a88f-4b76-8131-863a27687b42" alt=""><figcaption></figcaption></figure>

I recommend to block rooms between for prevent player use triggers through walls.

<figure><img src="https://1426670673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FekY9xNdT8kuOP48LQNQK%2Fuploads%2F9T1zzCH4L1CFgVLgE8fY%2Fimage.png?alt=media&#x26;token=4c2de4b0-6c87-444e-bc03-1c0963326968" alt=""><figcaption><p>Orange - blocks between rooms | Screenshot from old level editor</p></figcaption></figure>
