Viewport
Creates a ViewportFrame with size fitting and drag controls. This means that the viewport will center the camera around the given instance, and allow the user to control the camera itself.
local viewport = Viewport.new()
viewport:SetInstance(instance)
maid:GiveTask(viewport:Render({
Parent = target;
}):Subscribe())
Functions
new
Constructs a new viewport. Unlike a normal BasicPane this will not render anything immediately. See Viewport.Render for details.
blend
Creates a Viewport and render it to Blend. The following properties are supported
- Ambient - Color3
- AnchorPoint - Vector2
- FieldOfView - number
- Instance - Instance
- LayoutOrder - number
- LightColor - Color3
- Parent - Instance
- Position - UDim2
- Size - Vector3
- Transparency - number
Properties may be anything Blend would take as computable. See Blend for details.
SetControlsEnabled
Viewport:
SetControlsEnabled
(
enabled:
boolean
) →
(
)
Sets the enabled state of the ViewportControls
SetTransparency
Viewport:
SetTransparency
(
transparency:
number
) →
(
)
Sets the field of view on the viewport.
SetFieldOfView
Viewport:
SetFieldOfView
(
fieldOfView:
number
) →
(
)
Sets the field of view on the viewport.
SetInstance
Set the instance to be rendered. The instance will be reparented to the viewport.
warning
The instance you set here will NOT be destroyed by the viewport. This lets the performance be optimized or the instance used in good transitions. However, be sure to destroy it if you need to.
NotifyInstanceSizeChanged
Viewport:
NotifyInstanceSizeChanged
(
) →
(
)
Notifies the viewport of the instance size changing. We don't connect to any events here because the instance can be anything.
Render
Renders the viewport. Allows the following properties.
- Ambient - Color3
- ImageColor3 - Color3
- AnchorPoint - Vector2
- LayoutOrder - number
- LightColor - Color3
- Parent - Instance
- Position - UDim2
- Size - Vector3
- Transparency - number
warning
This should only be called once per a Viewport instance, since the Instance property is not duplicated.