Building Engine for Unity3D - How to create a new portal type

Portal design

We want to create a new type of portal for our building : an arched door.

Fisrt draw a bow that will contain your shape. Choose the width. The height is floorHeight - floorDepth. These values are defined in the Architectural properties component of the builder gameObject, which is a child of the Building Engine gameObject.

Get the portal box height

Using the game Architectural properties, we obtain a height of 3 (3.4 - 0.4). We choose a width of 2 (large enough for an avatar to go throught).

Portal box

Sketch the shape of your portal. You can use a 2D or 3D software to easily get the position of each vertex that create the shape of the portal.

- Stay inside the box.

- Let a margin at the left and the right side, correspondng of the wallDepth. This is needed when your portal is at the beginning or the end of a wall.

- Don't use concave shape.

Portal shape

Now divide your box in four quadrants : left-bottom, left-top, right-top, right-bottom. Theses quadrants are drawn from the center of the box.

Portal quadrant

Set-up Portal architectural properties

In the Architectural properties component of the builder gameObject, find the list of portal infos. Add 1 to the value of the size, in order to create a new entry.

Give it the name "archedDoorX1". The "X1" means thaht this portal have one door. For a two door arched door, we can use the name "archedDoorX2".

Now, we have to give the value of the outline. The outline is a list of 2D coordinates of the vertices that shape our portal. First count the number of vertex thaht draw your shape and give this value to the size of the outline. Give the coordinates in a clockwise direction, from the left-bottom quadrant, then left-top quadrant, then the right-top quadrant and finally the right-bottom quadrant. Make sure you do not repeat same coordinates, for example for vertex on the border of two quadants. You can use a 2D or 3D software to easily get the coordinatesof the vertices.

vertices_coordinates

Finally, set-up the size of the portal.

Portal infos

Verify your portal. Create two rooms in a building, and create a portal between them.

Arched door in a building

Add a prop

Arched door with prop

© 2017 Magyc Pixel. All rights reserved | Design by W3layouts