ViewportFrame does not set applicable camera properties for the virtual screen

Reproduction Steps
Reproduction of this issue is trivial.

  • Create a new ScreenGui inside of the StarterGui. Add a new ViewportFrame as a child of this ScreenGui. The size can be any size so long as it is greater than (1px, 1px), otherwise it is ambiguous with the unexpected result.
  • Create a new Camera. Set the ViewportFrame’s CurrentCamera property to this camera.

Expected Behavior
When I set the ViewportFrame’s camera to a given camera instance, I expect this camera instance to update its ViewportSize property to reflect upon the AbsoluteSize property of the ViewportFrame.

Actual Behavior
Rather than the ViewportSize property of the camera changing to reflect upon the size of its ViewportFrame, it remains at 1, 1. This wreaks havoc on all calculations based on the camera, such as when using ViewportPointToRay, which behaves as if my screen is a 1x1 pixel screen. This makes actions like positioning 3D objects at a specific pixel coordinate require convoluted workarounds to work correctly.

Currently, my workaround uses the fact that my ViewportFrame takes the full resolution of the screen, and has a camera identical to workspace.CurrentCamera. Because of this, I can do my calculations on workspace.CurrentCamera instead of the viewport camera.

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly

1 Like

It’s expected behavior as one camera can be assigned to multiple ViewportFrames with different size

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.