RectBase (Legacy)
- Last UpdatedDec 16, 2023
- 4 minute read
The RectBase node is an abstract node that is the base of almost all 2D user interface nodes. By itself, it cannot be used. It contains all the parameters that enable placement of 2D content.
Note: The legacy 2D nodes hierarchy has been replaced with a new and better performing hierarchy: 2D nodes. You should no longer use these older 2D nodes, except for very specific tasks.
Platform support
This node is supported on XR-Windows platform only.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
No support |
No support |
No support |
No support |
|
|
|
|
|
|
Hierarchy
Anchoring
By default, the 2D contents are anchored Top Left.
You can change the anchor position by using the anchorModeX and anchorModeY parameters.
anchorModeX
These are the values for anchorModeX.
|
Value |
Description |
|---|---|
|
Left |
Left is the default value. |
|
Right |
2D content is anchored to right instead of left. |
|
Center |
2D content is placed and kept in the horizontal center of the screen. |
anchorModeY
These are the values for anchorModeY.
|
Value |
Description |
|---|---|
|
Top |
Top is the default value. |
|
Bottom |
2D content is anchored to bottom instead of top. |
|
Center |
2D content is placed and kept in the vertical center of the screen. |
Resizing
When resizing the 3D panel, this causes the 2D content to be stretched.
This happens because the 2D coordinates are expressed in grid points (whose dimension is fixed) and not in pixels. Therefore, when the size of the container changes in pixels, the same grid points dimensions may cover a smaller or bigger area.
The resizeMode parameter offers a way to modify this behavior.
|
Value |
Description |
|---|---|
|
keepWidth |
When changing container width, the 2D content width is scaled accordingly and height is recalculated to maintain the content aspect ratio. When changing container height, the 2D content keeps its size (no scaling). |
|
keepHeight |
When changing container height, the 2D content height is scaled accordingly and width is recalculated to maintain the content aspect ratio. When changing container width, the 2D content keeps its size (no scaling). |
Fields
These are the fields for RectBase (Legacy) node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > RectBase
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
active |
sbool |
Optional |
true |
Activates or deactivates the node. When deactivated, the 2D node cannot interact with generating or receiving events. |
|
anchorModeX |
senum |
Optional |
Left |
Used to anchor the 2D content when resizing the 3D panel. Available options are Left, Right, and Center. |
|
anchorModeY |
senum |
Optional |
Top |
Used to anchor the 2D content when resizing the 3D panel. Available options are Top, Bottom, and Center. |
|
center |
svec2 |
Optional |
0 0 |
Sets the center of the 2D object in reference to its top-left corner. If set to a value different from “0 0” the object position is given by position-center. This is useful to position an object with the center on a particular coordinate. |
|
center3D |
svec3 |
Optional |
0 0 0 |
Adds a displacement with respect to the position3D coordinate, before converting it to screen coordinates. |
|
contextVisible |
sbool |
Read only |
false |
Checks if the context in which the node is defined is currently visible. |
|
fadeIn |
sfloat |
Optional |
Not set |
Trigger a fade-in behavior. The value passed is the fade action time in seconds. The action propagates to node children. |
|
fadeOut |
sfloat |
Optional |
Not set |
Triggers a fade-out behavior. The value passed is the fade action time in seconds. The action propagates to node children. |
|
order |
sint |
Optional |
100 |
The node z order that defines the display order of different children. The range is 0-255. |
|
position |
svec2 |
Optional |
0 0 |
If the node is the root of a 2D interface, the position is referred to screen coordinates, otherwise it is referred to its 2D node parent. |
|
position3D |
svec3 |
Optional |
0 0 0 |
Defines the 3D point coordinate to be converted into screen coordinate. |
|
position3DActive |
sbool |
Optional |
false |
If set to true, the node position is set to the screen converted coordinate of the position3D point. It can be used to display overlays of a 3D object. |
|
resizeMode |
senum |
Optional |
None |
Defines how the 2D content must be resized according to 3D panel size changing. Available options are none, keepWidth, and keepheight. |
|
scale |
svec2 |
Optional |
1 1 |
Proportionally scales the node. The action propagates to node children. |
|
show |
sbool |
Optional |
false |
Shows/hides the node. The action propagates to node children. |
|
size |
svec2 |
Optional |
-1 -1 |
Defines the dimension of the 2D object. If left to “-1 -1” parameter automatically sets to image content size. Works only if an image or movie is set. |