Room

Inherits: Spatial < Node < Object

Room node, used to group objects together locally for Portal culling.

Description

The Portal culling system requires levels to be built using objects grouped together by location in areas called Rooms. In many cases these will correspond to actual rooms in buildings, but not necessarily (a canyon area may be treated as a room).

Any VisualInstance that is a child or grandchild of a Room will be assigned to that room, if the portal_mode of that VisualInstance is set to STATIC (does not move) or DYNAMIC (moves only within the room).

Internally the room boundary must form a convex hull, and by default this is determined automatically by the geometry of the objects you place within the room.

You can alternatively precisely specify a manual bound. If you place a MeshInstance with a name prefixed by Bound_, it will turn off the bound generation from geometry, and instead use the vertices of this MeshInstance to directly calculate a convex hull during the conversion stage (see RoomManager).

In order to see from one room into an adjacent room, Portals must be placed over non-occluded openings between rooms. These will often be placed over doors and windows.

Properties

PoolVector3Array

points

PoolVector3Array(  )

float

room_simplify

0.5

bool

use_default_simplify

true

Methods

void

set_point ( int index, Vector3 position )


Property Descriptions

PoolVector3Array points = PoolVector3Array(  )

If points are set, the Room bounding convex hull will be built from these points. If no points are set, the room bound will either be derived from a manual bound (MeshInstance with name prefix Bound_), or from the geometry within the room.

Note that you can use the Generate Points editor button to get started. This will use either the geometry or manual bound to generate the room hull, and save the resulting points, allowing you to edit them to further refine the bound.


float room_simplify = 0.5

  • void set_room_simplify ( float value )

  • float get_room_simplify ( )

The simplify value determines to what degree room hulls (bounds) are simplified, by removing similar planes. A value of 0 gives no simplification, 1 gives maximum simplification.


bool use_default_simplify = true

  • void set_use_default_simplify ( bool value )

  • bool get_use_default_simplify ( )

The room hull simplification can either use the default value set in the RoomManager, or override this and use the per room setting.


Method Descriptions

void set_point ( int index, Vector3 position )

Sets individual points. Primarily for use by the editor.

Note: This function will not resize the point array. Set points to set the number of points.