Gluing a GUI Control to a node

(Difference between revisions)
Jump to: navigation, search
(added {{tocright}})
(See also: changed link to GUI_Editor#Presentation_States)
Line 40: Line 40:
==See also==
==See also==
* [[GUI Controls]]
* [[GUI Controls]]
* [[State Presentation]]
* [[GUI_Editor#Presentation_States|State Presentation]]

Revision as of 21:57, 10 November 2011



Sometimes it is desired to connect a particular GUI Control to a node in the game world, such that it appears to follow that node as it moves around. For example, to connect a chat bubble to a character that is walking around. This page explains how this is accomplished.

Related GUI Control Attributes

There are three GUI Control fields in particular which must be set:

For more information on the above three fields, please see their definitions in the section on "GUIControl Base Fields" on the GUIControls page.

Note that a control's position field still affects it when it is glued to a node; the easiest way to center a GUI Control over its target node is to place the offset point in the direct center of the node's bounding box, and lower the control's position by half of its height.

If a collidable asset obscures direct line-of-sight between the active camera and the point (in world space) to which the control is affixed, the control will be hidden. Generally speaking, character nodes and nodes created from prop buckets are not collidable assets.

While the GUI Control will follow its target node through the 3D world, it still resides on the GUI Layers system. This means that it will never appear to be behind an item located in 3D space, nor can it appear partially obscured - it is either completely visible or not at all. It will also not automatically scale based on the distance between the camera and the target node. If this behavior is desired, you should consider using a Billboard GUI, which actually does reside in the 3D world space.


The following code configures a base GUI Control that might be seen above a character when that character is targeted.

baseplate as noderef of class GUIControl = CreateNodeFromPrototype("_panel") = true = "NamePlate" + targetID
baseplate.size.x = 195
baseplate.size.y = 36
baseplate.gluedtonode = targetID
baseplate.fadeDistance = 2.5
baseplate.defaultStatePresentation.color.a = .0
baseplate.visible = true
baseplate.worldspaceoffset.y = .02

See also

Personal tools