Skip to reading
3D Models & Video in GUIs

Use the model actions from a script

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView illustrations
Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    await CenterGUIModel({
        "guiId": "model_lab",
        "elementId": "object_viewer"
    })
    return true

Create and apply this GDScript record, then run it from the intended Button or gameplay interaction. The IDs are the GUI and its element, not the source model asset ID.

Figure 14. The visual-script node uses the same two target IDs.

For a visual graph, connect the intended entry node to Center GUI Model. For an action list, add the same action and fill in the two selectors. You do not need a custom camera script just to recover the framing.

Page 19 of 45Permalink
Go to page