W3cubDocs

/Godot 2.1

Portal

Inherits: VisualInstance < Spatial < Node < Object

Category: Core

Brief Description

Portals provide virtual openings to rooms.

Member Functions

float get_connect_range ( ) const
float get_disable_distance ( ) const
Color get_disabled_color ( ) const
Vector2Array get_shape ( ) const
bool is_enabled ( ) const
void set_connect_range ( float range )
void set_disable_distance ( float distance )
void set_disabled_color ( Color color )
void set_enabled ( bool enable )
void set_shape ( Vector2Array points )

Description

Portals provide virtual openings to VisualInstance nodes, so cameras can look at them from the outside. Note that portals are a visibility optimization technique, and are in no way related to the game of the same name (as in, they are not used for teleportation). For more information on how rooms and portals work, see VisualInstance. Portals are represented as 2D convex polygon shapes (in the X,Y local plane), and are placed on the surface of the areas occupied by a VisualInstance, to indicate that the room can be accessed or looked-at through them. If two rooms are next to each other, and two similar portals in each of them share the same world position (and are parallel and opposed to each other), they will automatically “connect” and form “doors” (for example, the portals that connect a kitchen to a living room are placed in the door they share). Portals must always have a VisualInstance node as a parent, grandparent or far parent, or else they will not be active.

Member Function Description

float get_connect_range ( ) const

Return the range for auto-connecting two portals from different rooms sharing the same space.

float get_disable_distance ( ) const

Return the distance threshold for disabling the portal. Every time that the portal goes beyond “distance”, it disables itself, becoming the opaque color (see set_disabled_color).

Color get_disabled_color ( ) const

Return the color for when the portal goes beyond the disable distance (see set_disable_distance) and becomes disabled.

Vector2Array get_shape ( ) const

Return the portal shape. The shape is an array of Vector2 points, representing a convex polygon in the X,Y plane.

bool is_enabled ( ) const

Return whether the portal is active. When disabled it causes the parent VisualInstance to not be visible any longer when looking through the portal.

void set_connect_range ( float range )

Set the range for auto-connecting two portals from different rooms sharing the same space.

void set_disable_distance ( float distance )

Set the distance threshold for disabling the portal. Every time that the portal goes beyond “distance”, it disables itself, becoming the opaque color (see set_disabled_color).

void set_disabled_color ( Color color )

When the portal goes beyond the disable distance (see set_disable_distance), it becomes opaque and displayed with color “color”.

void set_enabled ( bool enable )

Enable the portal (it is enabled by default though), disabling it will cause the parent VisualInstance to not be visible any longer when looking through the portal.

void set_shape ( Vector2Array points )

Set the portal shape. The shape is an array of Vector2 points, representing a convex polygon in the X,Y plane.

© 2014–2017 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
http://docs.godotengine.org/en/2.1/classes/class_portal.html