Viewport
Viewports embed 3D objects inside your UI using Roblox viewport frames.
Playground
Allow orbit + zoom controls
Focus on object automatically
Usage
You can create a Viewport by calling the AddViewport method on a Groupbox.
Arguments
| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Index/ID of the viewport element | string | nil |
| 2 | Viewport configuration table | table | nil |
Configuration Table
Prop
Type
Methods
You can use the following methods to interact with the viewport element:
SetObject
Changes the displayed 3D object.
| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Object instance to display | Instance | nil |
SetCamera
Updates the camera instance.
| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Camera instance | Instance (Camera) | nil |
SetInteractive
Toggles user interaction.
| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Whether the viewport is interactive | boolean | nil |
SetHeight
Adjusts the viewport frame height.
| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Frame height in pixels | number | nil |
Focus
Focuses the camera on the object.
| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | No arguments | – | – |