From 51a1a56ac6f5bd33c642b3090664d1f1e3d1524c Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Thu, 31 Oct 2024 12:24:03 -0700 Subject: [PATCH 01/24] commit --- .../reference/engine/classes/Camera.yaml | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 0c0f2a928..2be83fbd1 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -238,6 +238,8 @@ properties: viewport to its opposite corner) the camera can view. See `Class.Camera.FieldOfView|FieldOfView` for a more general explanation of field of view. + + Note: the `Class.Camera.DiagonalFieldOfView` property represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area. The fullscreen area may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize` for more information. code_samples: type: float tags: @@ -271,6 +273,8 @@ properties: using binoculars. - Increasing FOV when the player is "sprinting" to give the impression of a lack of control. + + Note: the `Class.Camera.FieldOfView` property represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area. The fullscreen area may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize` for more information. code_samples: type: float tags: [] @@ -534,15 +538,23 @@ properties: writeCapabilities: [] - name: Camera.ViewportSize summary: | - Describes the dimensions, in pixels, of the client's viewport. + The dimensions of the device safe area rectangle on a Roblox client. + The units are in Roblox UI offset units, which may be different from + native display pixels. description: | - **ViewportSize** describes the dimensions, in pixels, of the client's - viewport. + The device safe area rectangle includes the Roblox top bar area, but does not include any display cutouts. + + Mobile device screen with cutout showing device safe area. + + Note: `Class.Camera.ViewportSize` is not equal to the fullscreen area size on displays with cutouts or notches. To obtain the fullscreen area size on all displays, you can query the `AbsoluteSize` property of a `Class.ScreenGui` with `ScreenInsets=None`. See `Enum.ScreenInsets` for a more information about how screen areas are defined. + + Mobile device screen with cutout showing fullscreen area. + + `Class.Camera.ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. - This property ignores the GUI inset applied by the top bar, meaning the - center of the screen can be found at precisely at 50% of the viewport in - both directions. You can find the position of a `Datatype.Vector3` in the - world on the viewport using `Class.Camera:WorldToViewportPoint()`. + Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. code_samples: type: Vector2 tags: From 5520c951f13d56dac57fc41927a91f10626f5e54 Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Thu, 31 Oct 2024 12:29:51 -0700 Subject: [PATCH 02/24] Add link --- content/en-us/reference/engine/classes/Camera.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 2be83fbd1..cef5c189c 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -555,6 +555,8 @@ properties: `Class.Camera.ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. + + To learn more about how your experience will run on a device with notches/cutouts, please see [this post](https://devforum.roblox.com/t/notched-screen-support-full-release/2074324/1). code_samples: type: Vector2 tags: From 7fc900eae596893757b1a6bd0b9deb599ae048fa Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Thu, 31 Oct 2024 12:34:13 -0700 Subject: [PATCH 03/24] fix typo --- content/en-us/reference/engine/classes/Camera.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index cef5c189c..867a20e86 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -554,7 +554,7 @@ properties: `Class.Camera.ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. - Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. + Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. To learn more about how your experience will run on a device with notches/cutouts, please see [this post](https://devforum.roblox.com/t/notched-screen-support-full-release/2074324/1). code_samples: From 1a46f8212736fc0350a2e75253d213163aa6b5a7 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:22:11 -1000 Subject: [PATCH 04/24] Apply suggestions from code review --- content/en-us/reference/engine/classes/Camera.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 867a20e86..2c9342289 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -239,7 +239,7 @@ properties: `Class.Camera.FieldOfView|FieldOfView` for a more general explanation of field of view. - Note: the `Class.Camera.DiagonalFieldOfView` property represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area. The fullscreen area may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize` for more information. + Note that `DiagonalFieldOfView` represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area which may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize|ViewportSize` for more information. code_samples: type: float tags: @@ -274,7 +274,7 @@ properties: - Increasing FOV when the player is "sprinting" to give the impression of a lack of control. - Note: the `Class.Camera.FieldOfView` property represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area. The fullscreen area may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize` for more information. + Note that `FieldOfView` represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area which may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize|ViewportSize` for more information. code_samples: type: float tags: [] @@ -539,7 +539,7 @@ properties: - name: Camera.ViewportSize summary: | The dimensions of the device safe area rectangle on a Roblox client. - The units are in Roblox UI offset units, which may be different from + The units are in Roblox UI offset units which may be different from native display pixels. description: | The device safe area rectangle includes the Roblox top bar area, but does not include any display cutouts. From af5857f47577f6e03f129e02e9de809c48e2c39c Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Thu, 31 Oct 2024 15:30:24 -0700 Subject: [PATCH 05/24] Add ViewportFrame info --- content/en-us/reference/engine/classes/Camera.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 2c9342289..3254867fc 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -538,11 +538,9 @@ properties: writeCapabilities: [] - name: Camera.ViewportSize summary: | - The dimensions of the device safe area rectangle on a Roblox client. - The units are in Roblox UI offset units which may be different from - native display pixels. + The dimensions of the device safe area on a Roblox client. description: | - The device safe area rectangle includes the Roblox top bar area, but does not include any display cutouts. + `Class.Camera.ViewportSize` returns the dimensions of the device safe area on the current screen. The device safe area is a rectangle which includes the Roblox top bar area, but does not include any cutouts in the display. The units of `Class.Camera.ViewportSize` are Roblox UI offset units, which may be different from native display pixels. Mobile device screen with cutout showing device safe area. @@ -557,6 +555,12 @@ properties: Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. To learn more about how your experience will run on a device with notches/cutouts, please see [this post](https://devforum.roblox.com/t/notched-screen-support-full-release/2074324/1). + + Only one `Class.Camera` has its `Class.Camera.ViewportSize` updated each frame: the `Class.Camera` currently referred to by `Class.Workspace.CurrentCamera`. The `ViewportSize` of all other `Class.Camera`s in your experience won't be updated. This includes `Class.Camera`s that are used for `Class.ViewportFrame`s. + + The initial value of `Class.Camera.ViewportSize` is `(1, 1)`. The `Class.Workspace.CurrentCamera`'s `Class.Camera.ViewportSize` is updated once each frame during the render prepare step. + + For example, a `Class.ViewportFrame` with `Class.ViewportFrame.CurrentCamera` set to a different `Class.Camera` than the `Class.Workspace.CurrentCamera` will have its `ViewportSize` equal to the initial value of `(1, 1)`. code_samples: type: Vector2 tags: From c1788805af8b9746c4361b129f0fbc17dedcaa25 Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Thu, 31 Oct 2024 15:33:14 -0700 Subject: [PATCH 06/24] edits --- content/en-us/reference/engine/classes/Camera.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 3254867fc..bde243060 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -546,12 +546,11 @@ properties: alt="Mobile device screen with cutout showing device safe area." /> Note: `Class.Camera.ViewportSize` is not equal to the fullscreen area size on displays with cutouts or notches. To obtain the fullscreen area size on all displays, you can query the `AbsoluteSize` property of a `Class.ScreenGui` with `ScreenInsets=None`. See `Enum.ScreenInsets` for a more information about how screen areas are defined. + `Class.Camera.ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. Mobile device screen with cutout showing fullscreen area. - `Class.Camera.ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. - Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. To learn more about how your experience will run on a device with notches/cutouts, please see [this post](https://devforum.roblox.com/t/notched-screen-support-full-release/2074324/1). From c965075194e967705357041561725d67aae8a2ae Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Thu, 31 Oct 2024 18:30:12 -0700 Subject: [PATCH 07/24] Also update Camera.ViewportPointToRay --- .../Camera/DeviceSafeViewportCoordinates.jpg | 3 ++ .../reference/engine/classes/Camera.yaml | 38 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg diff --git a/content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg b/content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg new file mode 100644 index 000000000..d1f6d2044 --- /dev/null +++ b/content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9312ebfe5c87f89601b3d9d5e1fceb2a6de46f5f4c1dede4596a4f5ba6e7b27 +size 107922 diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index bde243060..dc05e5638 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1175,20 +1175,24 @@ methods: summary: | Creates a unit `Datatype.Ray` from a position on the viewport (in pixels), at a given depth from the `Class.Camera`, orientated in the camera's - direction. Does not account for the GUI inset. + direction. Does not account for the Core UI inset. description: | - This function creates a unit `Datatype.Ray` from a 2D position on the - viewport (defined in pixels). This position does **not** account for the - GUI inset. The `Datatype.Ray` originates from the `Datatype.Vector3` - equivalent of the 2D position in the world at the given depth (in studs) - away from the `Class.Camera`. - - As this function does not acknowledge the GUI inset, the viewport position - given is not equivalent to the screen position used by GUI elements. If - you are not using `Class.ScreenGui.IgnoreGuiInset` and need an otherwise - identical function that accounts for the GUI offset, use + This function creates a unit `Datatype.Ray` from a 2D position in device safe viewport coordinates (defined in pixels). That is, `(0, 0)` corresponds to the top left point of the Roblox top bar. + + Diagram showing the origin of the device safe area viewport coordinate system. + + The input 2D position does **not** account for the Core UI inset, but does account for any device safe insets. + The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the world at the given depth (in studs) away from the `Class.Camera`. + + Note that UI instances use a different coordinate system. `Class.GuiObject.AbsolutePosition` uses the Core UI viewport coordinate system, while this function uses the device safe viewport coordinate system. If you would like to specify position in Core UI coordinates, please use `Class.Camera:ScreenPointToRay()`. + This function only works for the current Workspace camera. Other cameras, + such as those you create for a `Class.ViewportFrame`, have an initial + viewport size of `(1, 1)` and are only updated after you set them to + `Class.Workspace.CurrentCamera`. The mismatch in viewport size causes the + camera to return a ray with an incorrect `Datatype.Ray.Direction`. + This function can be used in conjunction with the `Class.Camera.ViewportSize` property to create a ray from the centre of the screen, for example: @@ -1208,12 +1212,6 @@ methods: local unitRay = camera:ScreenPointToRay(100, 100) local extendedRay = Ray.new(unitRay.Origin, unitRay.Direction * length) ``` - - This function only works for the current Workspace camera. Other cameras, - such as those you create for a `Class.ViewportFrame`, have an initial - viewport size of `(1, 1)` and are only updated after you set them to - `Class.Workspace.CurrentCamera`. The mismatch in viewport size causes the - camera to return a ray with an incorrect `Datatype.Ray.Direction`. code_samples: parameters: - name: x @@ -1221,15 +1219,13 @@ methods: default: summary: | The position on the X axis, in pixels, of the viewport point at which - to originate the `Datatype.Ray`. This position does not account for - the GUI inset. + to originate the `Datatype.Ray`. In device safe area coordinates. - name: 'y' type: float default: summary: | The position on the Y axis, in pixels, of the viewport point at which - to originate the `Datatype.Ray`. This position does not account for - the GUI inset. + to originate the `Datatype.Ray`. In device safe area coordinates. - name: depth type: float default: 0 From fd5596933506429032c92c2f89402c159deb963a Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 06:18:19 -1000 Subject: [PATCH 08/24] Apply suggestions from code review --- content/en-us/reference/engine/classes/Camera.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index dc05e5638..871fe0a9f 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1218,14 +1218,14 @@ methods: type: float default: summary: | - The position on the X axis, in pixels, of the viewport point at which - to originate the `Datatype.Ray`. In device safe area coordinates. + The position on the **X** axis, in pixels, of the viewport point at which + to originate the `Datatype.Ray`, in device safe area coordinates. - name: 'y' type: float default: summary: | - The position on the Y axis, in pixels, of the viewport point at which - to originate the `Datatype.Ray`. In device safe area coordinates. + The position on the **Y** axis, in pixels, of the viewport point at which + to originate the `Datatype.Ray`, in device safe area coordinates. - name: depth type: float default: 0 From 64b4fafe560eb812290e2fa5cb15186c1e70ad28 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 06:22:31 -1000 Subject: [PATCH 09/24] Update content/en-us/reference/engine/classes/Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 871fe0a9f..82b2aeaf0 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1175,7 +1175,7 @@ methods: summary: | Creates a unit `Datatype.Ray` from a position on the viewport (in pixels), at a given depth from the `Class.Camera`, orientated in the camera's - direction. Does not account for the Core UI inset. + direction. Does not account for the `Enum.ScreenInsets|CoreUISafeInsets` inset. description: | This function creates a unit `Datatype.Ray` from a 2D position in device safe viewport coordinates (defined in pixels). That is, `(0, 0)` corresponds to the top left point of the Roblox top bar. From 64f5fcde337297a8ef560ac1d5d64214d1a46dbd Mon Sep 17 00:00:00 2001 From: Alex <73556282+ap4123@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:55:26 -0700 Subject: [PATCH 10/24] Update content/en-us/reference/engine/classes/Camera.yaml Co-authored-by: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> --- .../en-us/reference/engine/classes/Camera.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 82b2aeaf0..e19791f2f 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1177,14 +1177,20 @@ methods: at a given depth from the `Class.Camera`, orientated in the camera's direction. Does not account for the `Enum.ScreenInsets|CoreUISafeInsets` inset. description: | - This function creates a unit `Datatype.Ray` from a 2D position in device safe viewport coordinates (defined in pixels). That is, `(0, 0)` corresponds to the top left point of the Roblox top bar. + This function creates a unit `Datatype.Ray` from a 2D position in device safe viewport coordinates, + defined in pixels. That is, `(0, 0)` corresponds to the top-left point of the Roblox top bar. The input + 2D position does **not** account for the `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does + account for any `Enum.ScreenInsets|DeviceSafeInsets`. - Diagram showing the origin of the device safe area viewport coordinate system. - - The input 2D position does **not** account for the Core UI inset, but does account for any device safe insets. - The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the world at the given depth (in studs) away from the `Class.Camera`. + Diagram showing the origin of the device safe area viewport coordinate system. + + The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the + world at the given depth (in studs) away from the `Class.Camera`. - Note that UI instances use a different coordinate system. `Class.GuiObject.AbsolutePosition` uses the Core UI viewport coordinate system, while this function uses the device safe viewport coordinate system. If you would like to specify position in Core UI coordinates, please use + Note that UI instances use a different coordinate system. `Class.GuiObject.AbsolutePosition` uses + the `Enum.ScreenInsets|CoreUISafeInsets` viewport coordinate system, while this function uses the + `Enum.ScreenInsets|DeviceSafeInsets` viewport coordinate system. If you would like to specify + position in core UI coordinates, please use `Class.Camera:ScreenPointToRay()`. This function only works for the current Workspace camera. Other cameras, From cf4d2e7c5a80206b4c818faf268a68c2aa9f8ce7 Mon Sep 17 00:00:00 2001 From: Alex <73556282+ap4123@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:01:52 -0700 Subject: [PATCH 11/24] Update content/en-us/reference/engine/classes/Camera.yaml Co-authored-by: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> --- content/en-us/reference/engine/classes/Camera.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index e19791f2f..9c4c57761 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1193,12 +1193,11 @@ methods: position in core UI coordinates, please use `Class.Camera:ScreenPointToRay()`. - This function only works for the current Workspace camera. Other cameras, - such as those you create for a `Class.ViewportFrame`, have an initial + Also note that this function only works for the `Class.Workspace.CurrentCamera` camera. + Other cameras, such as those you create for a `Class.ViewportFrame`, have an initial viewport size of `(1, 1)` and are only updated after you set them to - `Class.Workspace.CurrentCamera`. The mismatch in viewport size causes the - camera to return a ray with an incorrect `Datatype.Ray.Direction`. - + `Class.Workspace.CurrentCamera|CurrentCamera`. The mismatch in viewport size causes + the camera to return a ray with an incorrect `Datatype.Ray.Direction`. This function can be used in conjunction with the `Class.Camera.ViewportSize` property to create a ray from the centre of the screen, for example: From d891dea1a947884e5e129d71ae7eb561baefb22a Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Fri, 1 Nov 2024 11:14:59 -0700 Subject: [PATCH 12/24] line wrapping --- .../reference/engine/classes/Camera.yaml | 115 ++++++++++++------ 1 file changed, 79 insertions(+), 36 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 9c4c57761..6d39fc76a 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -239,7 +239,10 @@ properties: `Class.Camera.FieldOfView|FieldOfView` for a more general explanation of field of view. - Note that `DiagonalFieldOfView` represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area which may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize|ViewportSize` for more information. + Note that `DiagonalFieldOfView` represents the field of view that is + visible by the `Class.Camera` rendering into the fullscreen area which + may be occluded by notches or screen cutouts on some devices. See `Class. + Camera.ViewportSize|ViewportSize` for more information. code_samples: type: float tags: @@ -274,7 +277,10 @@ properties: - Increasing FOV when the player is "sprinting" to give the impression of a lack of control. - Note that `FieldOfView` represents the field of view that is visible by the `Class.Camera` rendering into the fullscreen area which may be occluded by notches or screen cutouts on some devices. See `Class.Camera.ViewportSize|ViewportSize` for more information. + Note that `FieldOfView` represents the field of view that is visible by + the `Class.Camera` rendering into the fullscreen area which may be + occluded by notches or screen cutouts on some devices. See `Class.Camera. + ViewportSize|ViewportSize` for more information. code_samples: type: float tags: [] @@ -540,26 +546,53 @@ properties: summary: | The dimensions of the device safe area on a Roblox client. description: | - `Class.Camera.ViewportSize` returns the dimensions of the device safe area on the current screen. The device safe area is a rectangle which includes the Roblox top bar area, but does not include any cutouts in the display. The units of `Class.Camera.ViewportSize` are Roblox UI offset units, which may be different from native display pixels. - - Mobile device screen with cutout showing device safe area. - Note: `Class.Camera.ViewportSize` is not equal to the fullscreen area size on displays with cutouts or notches. To obtain the fullscreen area size on all displays, you can query the `AbsoluteSize` property of a `Class.ScreenGui` with `ScreenInsets=None`. See `Enum.ScreenInsets` for a more information about how screen areas are defined. - `Class.Camera.ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. - - Mobile device screen with cutout showing fullscreen area. - Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the fullscreen area. Also the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize`. + Note: `Class.Camera.ViewportSize` is not the actual viewport size the + camera uses for rendering. The Camera renders in the fullscreen area. + Also the `Class.Camera.FieldOfView` and `Class.Camera. + DiagonalFieldOfView` properties are based on the fullscreen area, not + `Class.Camera.ViewportSize`. - To learn more about how your experience will run on a device with notches/cutouts, please see [this post](https://devforum.roblox.com/t/notched-screen-support-full-release/2074324/1). - - Only one `Class.Camera` has its `Class.Camera.ViewportSize` updated each frame: the `Class.Camera` currently referred to by `Class.Workspace.CurrentCamera`. The `ViewportSize` of all other `Class.Camera`s in your experience won't be updated. This includes `Class.Camera`s that are used for `Class.ViewportFrame`s. - - The initial value of `Class.Camera.ViewportSize` is `(1, 1)`. The `Class.Workspace.CurrentCamera`'s `Class.Camera.ViewportSize` is updated once each frame during the render prepare step. - - For example, a `Class.ViewportFrame` with `Class.ViewportFrame.CurrentCamera` set to a different `Class.Camera` than the `Class.Workspace.CurrentCamera` will have its `ViewportSize` equal to the initial value of `(1, 1)`. + To learn more about how your experience will run on a device with notches/ + cutouts, please see [this post](https://devforum.roblox.com/t/ + notched-screen-support-full-release/2074324/1). + + Only one `Class.Camera` has its `Class.Camera.ViewportSize` updated each + frame: the `Class.Camera` currently referred to by `Class.Workspace. + CurrentCamera`. The `ViewportSize` of all other `Class.Camera`s in your + experience won't be updated. This includes `Class.Camera`s that are used + for `Class.ViewportFrame`s. + + The initial value of `Class.Camera.ViewportSize` is `(1, 1)`. The `Class. + Workspace.CurrentCamera`'s `Class.Camera.ViewportSize` is updated once + each frame during the render prepare step. + + For example, a `Class.ViewportFrame` with `Class.ViewportFrame. + CurrentCamera` set to a different `Class.Camera` than the `Class. + Workspace.CurrentCamera` will have its `ViewportSize` equal to the + initial value of `(1, 1)`. code_samples: type: Vector2 tags: @@ -1177,27 +1210,35 @@ methods: at a given depth from the `Class.Camera`, orientated in the camera's direction. Does not account for the `Enum.ScreenInsets|CoreUISafeInsets` inset. description: | - This function creates a unit `Datatype.Ray` from a 2D position in device safe viewport coordinates, - defined in pixels. That is, `(0, 0)` corresponds to the top-left point of the Roblox top bar. The input - 2D position does **not** account for the `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does + This function creates a unit `Datatype.Ray` from a 2D position in device + safe viewport coordinates, + defined in pixels. That is, `(0, 0)` corresponds to the top-left point of + the Roblox top bar. The input 2D position does **not** account for the + `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does account for any `Enum.ScreenInsets|DeviceSafeInsets`. - Diagram showing the origin of the device safe area viewport coordinate system. + Diagram showing the 
+      origin of the device safe area viewport coordinate system. - The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the - world at the given depth (in studs) away from the `Class.Camera`. + The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the world at the given depth (in studs) away from the + `Class.Camera`. - Note that UI instances use a different coordinate system. `Class.GuiObject.AbsolutePosition` uses - the `Enum.ScreenInsets|CoreUISafeInsets` viewport coordinate system, while this function uses the - `Enum.ScreenInsets|DeviceSafeInsets` viewport coordinate system. If you would like to specify - position in core UI coordinates, please use + Note that UI instances use a different coordinate system. `Class. + GuiObject.AbsolutePosition` uses + the `Enum.ScreenInsets|CoreUISafeInsets` viewport coordinate system, + while this function uses the + `Enum.ScreenInsets|DeviceSafeInsets` viewport coordinate system. If you + would like to specify position in core UI coordinates, please use `Class.Camera:ScreenPointToRay()`. - Also note that this function only works for the `Class.Workspace.CurrentCamera` camera. - Other cameras, such as those you create for a `Class.ViewportFrame`, have an initial - viewport size of `(1, 1)` and are only updated after you set them to - `Class.Workspace.CurrentCamera|CurrentCamera`. The mismatch in viewport size causes - the camera to return a ray with an incorrect `Datatype.Ray.Direction`. + Also note that this function only works for the `Class.Workspace. + CurrentCamera` camera. + Other cameras, such as those you create for a `Class.ViewportFrame`, have + an initial viewport size of `(1, 1)` and are only updated after you set + them to `Class.Workspace.CurrentCamera|CurrentCamera`. The mismatch in + viewport size causes the camera to return a ray with an incorrect + `Datatype.Ray.Direction`. This function can be used in conjunction with the `Class.Camera.ViewportSize` property to create a ray from the centre of the screen, for example: @@ -1223,14 +1264,16 @@ methods: type: float default: summary: | - The position on the **X** axis, in pixels, of the viewport point at which - to originate the `Datatype.Ray`, in device safe area coordinates. + The position on the **X** axis, in pixels, of the viewport point at + which to originate the `Datatype.Ray`, in device safe area + coordinates. - name: 'y' type: float default: summary: | - The position on the **Y** axis, in pixels, of the viewport point at which - to originate the `Datatype.Ray`, in device safe area coordinates. + The position on the **Y** axis, in pixels, of the viewport point at + which to originate the `Datatype.Ray`, in device safe area + coordinates. - name: depth type: float default: 0 From 2cb9e82eb977d152153cdeba56092587ad4034d1 Mon Sep 17 00:00:00 2001 From: Alex Popescu Date: Fri, 1 Nov 2024 11:46:32 -0700 Subject: [PATCH 13/24] Add new images. --- .../Camera/DeviceSafeAreaVsFullscreen.png | 3 +++ .../Camera/DeviceSafeViewportCoordinates.jpg | 3 --- .../Camera/ViewportPointToRayOrigin.png | 3 +++ .../reference/engine/classes/Camera.yaml | 21 ++++++++----------- 4 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 content/en-us/assets/engine-api/classes/Camera/DeviceSafeAreaVsFullscreen.png delete mode 100644 content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg create mode 100644 content/en-us/assets/engine-api/classes/Camera/ViewportPointToRayOrigin.png diff --git a/content/en-us/assets/engine-api/classes/Camera/DeviceSafeAreaVsFullscreen.png b/content/en-us/assets/engine-api/classes/Camera/DeviceSafeAreaVsFullscreen.png new file mode 100644 index 000000000..b196f93ca --- /dev/null +++ b/content/en-us/assets/engine-api/classes/Camera/DeviceSafeAreaVsFullscreen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6913ee127d7270f5d1622bb070c0f4ba075813cc221eebe30239425fbc75a432 +size 303211 diff --git a/content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg b/content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg deleted file mode 100644 index d1f6d2044..000000000 --- a/content/en-us/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f9312ebfe5c87f89601b3d9d5e1fceb2a6de46f5f4c1dede4596a4f5ba6e7b27 -size 107922 diff --git a/content/en-us/assets/engine-api/classes/Camera/ViewportPointToRayOrigin.png b/content/en-us/assets/engine-api/classes/Camera/ViewportPointToRayOrigin.png new file mode 100644 index 000000000..171b56cba --- /dev/null +++ b/content/en-us/assets/engine-api/classes/Camera/ViewportPointToRayOrigin.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e049042542892316c1aff60de6165cd56b3e9a80c1438a62832d0bcae61fe4ed +size 286189 diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 6d39fc76a..7f32725d4 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -552,22 +552,18 @@ properties: display. The units of `Class.Camera.ViewportSize` are Roblox UI offset units, which may be different from native display pixels. - Mobile device screen with cutout showing device safe area. + Mobile device screen with cutout showing device safe 
+      area. Note: `Class.Camera.ViewportSize` is not equal to the fullscreen area size on displays with cutouts or notches. To obtain the fullscreen area size on all displays, you can query the `AbsoluteSize` property of a `Class.ScreenGui` with `ScreenInsets=None`. See `Enum.ScreenInsets` for a more information about how screen areas are defined. - `Class.Camera.ViewportSize` is not equal to the fullscreen size in order - to improve cross-platform compatibility and backwards compatibility with - legacy experiences. - Mobile device screen with cutout showing fullscreen area. + `Class.Camera.ViewportSize|ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. Note: `Class.Camera.ViewportSize` is not the actual viewport size the camera uses for rendering. The Camera renders in the fullscreen area. @@ -1217,9 +1213,9 @@ methods: `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does account for any `Enum.ScreenInsets|DeviceSafeInsets`. - Diagram showing the 
-      origin of the device safe area viewport coordinate system. + Diagram showing the origin of the device safe area 
+      viewport coordinate system. The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the world at the given depth (in studs) away from the `Class.Camera`. @@ -1239,6 +1235,7 @@ methods: them to `Class.Workspace.CurrentCamera|CurrentCamera`. The mismatch in viewport size causes the camera to return a ray with an incorrect `Datatype.Ray.Direction`. + This function can be used in conjunction with the `Class.Camera.ViewportSize` property to create a ray from the centre of the screen, for example: From 5e979c72fcc6eff4c81801423ce103ad058524dd Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:20:58 -1000 Subject: [PATCH 14/24] Update content/en-us/reference/engine/classes/Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 7f32725d4..301c2aa66 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -546,11 +546,11 @@ properties: summary: | The dimensions of the device safe area on a Roblox client. description: | - `Class.Camera.ViewportSize` returns the dimensions of the device safe - area on the current screen. The device safe area is a rectangle which - includes the Roblox top bar area, but does not include any cutouts in the - display. The units of `Class.Camera.ViewportSize` are Roblox UI offset - units, which may be different from native display pixels. + `Class.Camera.ViewportSize` returns the dimensions of the + device safe area on the current screen. This area is a rectangle which + includes the Roblox top bar area but does not include any device notches + or screen cutouts. The units of `Class.Camera.ViewportSize` are Roblox + UI offset units which may be different from native display pixels. Date: Fri, 1 Nov 2024 13:21:59 -1000 Subject: [PATCH 15/24] Update content/en-us/reference/engine/classes/Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 301c2aa66..33c11d82f 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -553,8 +553,8 @@ properties: UI offset units which may be different from native display pixels. Mobile device screen with cutout showing device safe 
+      src= Note: `Class.Camera.ViewportSize` is not equal to the fullscreen area From 7945a09af91479d476ec12469bd3a17a0c80bc43 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:23:19 -1000 Subject: [PATCH 16/24] Update content/en-us/reference/engine/classes/Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 33c11d82f..7ca3a7aec 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -557,11 +557,12 @@ properties: width="840" alt="Mobile device screen with cutout showing device safe area." /> - Note: `Class.Camera.ViewportSize` is not equal to the fullscreen area - size on displays with cutouts or notches. To obtain the fullscreen area - size on all displays, you can query the `AbsoluteSize` property of a - `Class.ScreenGui` with `ScreenInsets=None`. See `Enum.ScreenInsets` for a - more information about how screen areas are defined. + As noted above, `Class.Camera.ViewportSize` is not equal to the fullscreen area size + on displays with cutouts or + notches. To obtain the fullscreen area size on all displays, you can query the + `Class.ScreenGui.AbsoluteSize|AbsoluteSize` property of a `Class.ScreenGui` with + `Class.ScreenGui.ScreenInsets|ScreenInsets` set to `Enum.ScreenInsets.None|None`. See + `Enum.ScreenInsets` for a more information about how screen areas are defined. `Class.Camera.ViewportSize|ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. From 2d5fb857ad932a4f40fccccfb4331400e160ee34 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:25:22 -1000 Subject: [PATCH 17/24] Update content/en-us/reference/engine/classes/Camera.yaml --- .../en-us/reference/engine/classes/Camera.yaml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 7ca3a7aec..7f421f57a 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -564,17 +564,10 @@ properties: `Class.ScreenGui.ScreenInsets|ScreenInsets` set to `Enum.ScreenInsets.None|None`. See `Enum.ScreenInsets` for a more information about how screen areas are defined. - `Class.Camera.ViewportSize|ViewportSize` is not equal to the fullscreen size in order to improve cross-platform compatibility and backwards compatibility with legacy experiences. - - Note: `Class.Camera.ViewportSize` is not the actual viewport size the - camera uses for rendering. The Camera renders in the fullscreen area. - Also the `Class.Camera.FieldOfView` and `Class.Camera. - DiagonalFieldOfView` properties are based on the fullscreen area, not - `Class.Camera.ViewportSize`. - - To learn more about how your experience will run on a device with notches/ - cutouts, please see [this post](https://devforum.roblox.com/t/ - notched-screen-support-full-release/2074324/1). + Finally, note that `Class.Camera.ViewportSize` is not the actual viewport size the camera + uses for rendering (the camera renders in the fullscreen area). Also, the + `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are + based on the fullscreen area, not `Class.Camera.ViewportSize`. Only one `Class.Camera` has its `Class.Camera.ViewportSize` updated each frame: the `Class.Camera` currently referred to by `Class.Workspace. From 1b632a56064c5e6a93f4a5c7ac21ca62a7af9f88 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:26:04 -1000 Subject: [PATCH 18/24] Update content/en-us/reference/engine/classes/Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 7f421f57a..e94b26626 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -552,10 +552,7 @@ properties: or screen cutouts. The units of `Class.Camera.ViewportSize` are Roblox UI offset units which may be different from native display pixels. - Mobile device screen with cutout showing device safe 
-      area. + Mobile device screen with cutout showing device safe area. As noted above, `Class.Camera.ViewportSize` is not equal to the fullscreen area size on displays with cutouts or From 0ef156490df02f81f647ed4eff05b0622c2073f1 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:29:07 -1000 Subject: [PATCH 19/24] Apply suggestions from code review --- content/en-us/reference/engine/classes/Camera.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index e94b26626..d8de45b7d 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -546,25 +546,25 @@ properties: summary: | The dimensions of the device safe area on a Roblox client. description: | - `Class.Camera.ViewportSize` returns the dimensions of the + `Class.Camera.ViewportSize|ViewportSize` returns the dimensions of the device safe area on the current screen. This area is a rectangle which includes the Roblox top bar area but does not include any device notches - or screen cutouts. The units of `Class.Camera.ViewportSize` are Roblox + or screen cutouts. The units of `Class.Camera.ViewportSize|ViewportSize` are Roblox UI offset units which may be different from native display pixels. Mobile device screen with cutout showing device safe area. - As noted above, `Class.Camera.ViewportSize` is not equal to the fullscreen area size - on displays with cutouts or + As noted above, `Class.Camera.ViewportSize|ViewportSize` is not equal to the fullscreen + area size on displays with cutouts or notches. To obtain the fullscreen area size on all displays, you can query the `Class.ScreenGui.AbsoluteSize|AbsoluteSize` property of a `Class.ScreenGui` with `Class.ScreenGui.ScreenInsets|ScreenInsets` set to `Enum.ScreenInsets.None|None`. See `Enum.ScreenInsets` for a more information about how screen areas are defined. - Finally, note that `Class.Camera.ViewportSize` is not the actual viewport size the camera - uses for rendering (the camera renders in the fullscreen area). Also, the + Finally, note that `Class.Camera.ViewportSize|ViewportSize` is not the actual viewport size + the camera uses for rendering (the camera renders in the fullscreen area). Also, the `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are - based on the fullscreen area, not `Class.Camera.ViewportSize`. + based on the fullscreen area, not `Class.Camera.ViewportSize|ViewportSize`. Only one `Class.Camera` has its `Class.Camera.ViewportSize` updated each frame: the `Class.Camera` currently referred to by `Class.Workspace. From 22dc84828e541a473bf0f5ca4ac7673d99fc23f6 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:38:29 -1000 Subject: [PATCH 20/24] Update content/en-us/reference/engine/classes/Camera.yaml --- .../reference/engine/classes/Camera.yaml | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index d8de45b7d..d3ca3c0ba 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -566,20 +566,14 @@ properties: `Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are based on the fullscreen area, not `Class.Camera.ViewportSize|ViewportSize`. - Only one `Class.Camera` has its `Class.Camera.ViewportSize` updated each - frame: the `Class.Camera` currently referred to by `Class.Workspace. - CurrentCamera`. The `ViewportSize` of all other `Class.Camera`s in your - experience won't be updated. This includes `Class.Camera`s that are used - for `Class.ViewportFrame`s. - - The initial value of `Class.Camera.ViewportSize` is `(1, 1)`. The `Class. - Workspace.CurrentCamera`'s `Class.Camera.ViewportSize` is updated once - each frame during the render prepare step. - - For example, a `Class.ViewportFrame` with `Class.ViewportFrame. - CurrentCamera` set to a different `Class.Camera` than the `Class. - Workspace.CurrentCamera` will have its `ViewportSize` equal to the - initial value of `(1, 1)`. + ##### Camera Updates + + Only the `Class.Camera` currently referred to by `Class.Workspace. + CurrentCamera` has its `Class.Camera.ViewportSize|ViewportSize` updated each + frame during the `Class.RunService.PreRender|PreRender` step. The + `Class.Camera.ViewportSize|ViewportSize` of all other cameras in your + experience won't be updated, including those used for + `Class.ViewportFrame|ViewportFrames`. code_samples: type: Vector2 tags: From 7d51b9bf1cb06bd113dd0af26931f403921701b2 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:39:27 -1000 Subject: [PATCH 21/24] Update content/en-us/reference/engine/classes/Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index d3ca3c0ba..a12fd81e2 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1198,9 +1198,7 @@ methods: `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does account for any `Enum.ScreenInsets|DeviceSafeInsets`. - Diagram showing the origin of the device safe area 
-      viewport coordinate system. + Diagram showing the origin of the device safe area viewport coordinate system. The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the world at the given depth (in studs) away from the `Class.Camera`. From c880be23bb75c94e8a15b181a7450ce7b4ecd759 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:47:26 -1000 Subject: [PATCH 22/24] Apply suggestions from code review --- .../reference/engine/classes/Camera.yaml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index a12fd81e2..8a480985b 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1192,22 +1192,22 @@ methods: direction. Does not account for the `Enum.ScreenInsets|CoreUISafeInsets` inset. description: | This function creates a unit `Datatype.Ray` from a 2D position in device - safe viewport coordinates, - defined in pixels. That is, `(0, 0)` corresponds to the top-left point of - the Roblox top bar. The input 2D position does **not** account for the - `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does - account for any `Enum.ScreenInsets|DeviceSafeInsets`. + safe viewport coordinates, defined in pixels. The ray originates from the + `Datatype.Vector3` equivalent of the 2D position in the world at the + given depth (in studs) away from the `Class.Camera`. + + As illustrated below, `(0, 0)` corresponds to the top‑left point of the Roblox + top bar. This means that the input 2D position does **not** account for the + `Enum.ScreenInsets|CoreUISafeInsets` inset, but it does account for any + `Enum.ScreenInsets|DeviceSafeInsets`. Diagram showing the origin of the device safe area viewport coordinate system. - The `Datatype.Ray` originates from the `Datatype.Vector3` equivalent of the 2D position in the world at the given depth (in studs) away from the - `Class.Camera`. - - Note that UI instances use a different coordinate system. `Class. - GuiObject.AbsolutePosition` uses - the `Enum.ScreenInsets|CoreUISafeInsets` viewport coordinate system, - while this function uses the - `Enum.ScreenInsets|DeviceSafeInsets` viewport coordinate system. If you + Note that UI instances use a different coordinate system + (`Class.GuiObject.AbsolutePosition` uses the + `Enum.ScreenInsets|CoreUISafeInsets` viewport coordinate system + while this function uses the `Enum.ScreenInsets|DeviceSafeInsets` + viewport coordinate system). If you would like to specify position in core UI coordinates, please use `Class.Camera:ScreenPointToRay()`. From 3c30d2fa2371cf72901ed6a6659af12d692092f9 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:48:59 -1000 Subject: [PATCH 23/24] Apply suggestions from code review --- content/en-us/reference/engine/classes/Camera.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 8a480985b..03a25c101 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1220,7 +1220,7 @@ methods: `Datatype.Ray.Direction`. This function can be used in conjunction with the - `Class.Camera.ViewportSize` property to create a ray from the centre of + `Class.Camera.ViewportSize|ViewportSize` property to create a ray from the centre of the screen, for example: ```lua From be29a080d794560659317ce857de4a021c80a767 Mon Sep 17 00:00:00 2001 From: IgnisRBX <43388550+IgnisRBX@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:50:48 -1000 Subject: [PATCH 24/24] Update Camera.yaml --- content/en-us/reference/engine/classes/Camera.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/content/en-us/reference/engine/classes/Camera.yaml b/content/en-us/reference/engine/classes/Camera.yaml index 03a25c101..0764bdd8b 100644 --- a/content/en-us/reference/engine/classes/Camera.yaml +++ b/content/en-us/reference/engine/classes/Camera.yaml @@ -1224,7 +1224,10 @@ methods: the screen, for example: ```lua - local camera = workspace.CurrentCamera + local Workspace = game:GetService("Workspace") + + local camera = Workspace.CurrentCamera + local viewportPoint = camera.ViewportSize / 2 local unitRay = camera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y, 0) ``` @@ -1233,7 +1236,10 @@ methods: create a longer ray, you can do the following: ```lua - local camera = workspace.CurrentCamera + local Workspace = game:GetService("Workspace") + + local camera = Workspace.CurrentCamera + local length = 500 local unitRay = camera:ScreenPointToRay(100, 100) local extendedRay = Ray.new(unitRay.Origin, unitRay.Direction * length)