Update TUTORIAL.md

This commit is contained in:
lawnjelly 2019-09-18 13:22:57 +01:00 committed by GitHub
parent 033fcfefed
commit 791d8709a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,16 +5,27 @@ _(A complete project is available in the LPortalTutorial.zip file.)_
2) Add an LRoomManager node as a child of the Root, and call it 'RoomList'. This will be where you place your rooms.
3) Create a spatial under the RoomList, and name it 'room_kitchen'.
4) As children of room_kitchen, create simple MeshInstance boxes for a floor and 4 walls, but make one of the walls out of 2 boxes, leaving a hole for a doorway.
![kitchen](images/kitchen.png)
5) Duplicate the entire room, and change the name to 'room_lounge'.
6) Change the location and rotation of the lounge so that the two rooms join, and the doorways match up.
7) Now we will add a portal to see between the rooms. There is no need to add it to both. Create a MeshInstance inside room_kitchen and name it 'portal_lounge'. This tells the system that you are making a portal that will see from the kitchen to the lounge.
8) The MeshInstance for portal_lounge should be a plane, and you should rotate and translate and scale it into position so it covers the doorway, facing into the lounge. You can give it a different color material to help see it.
![both_rooms](images/both_rooms.png)
9) At this point the room scene is complete, and we will create some of the usual objects needed in a game.
10) Create a camera as a child of the Root named 'Camera', and place it within the kitchen, pointing towards the lounge through the door.
11) In order to see where the camera node is, create a MeshInstance as a child of the node, and create a narrow box, facing along the direction the camera is pointing. Give this mesh instance a different color material so it is easy to see.
![camera](images/camera.png)
12) Create a SECOND camera as a child of the Root called 'Camera_Above', and place it above both rooms, looking down, and choose 'make current' in the IDE to make it the camera Godot uses (rather than the first camera).
13) Save the scene and run it, you should be able to see both rooms from above, with the box for the first camera.
![nodes](images/nodes.png)
Now it is time to start using LPortal.
14) Create a script for the Root node, call it 'Root.gd'.
@ -37,6 +48,9 @@ func _process(delta):
$Camera.rotate_y(delta)
```
15) Now run the project. If all goes well you should now see the camera rotating from above, and different parts of the rooms get hidden and shown as they come into and out of view.
![culling](images/culling.png)
16) Now try moving the 'Camera' node to different locations in the room, and running again. You should be able to find camera locations where walls never come into view, because they are not visible through the portal.
17) Try adding other MeshInstances to the rooms - tables, chairs etc. See them culled as they move in and out of view.