Skip to content

Commit

Permalink
Update content/en-us/reference/engine/classes/Camera.yaml
Browse files Browse the repository at this point in the history
Co-authored-by: IgnisRBX <[email protected]>
  • Loading branch information
ap4123 and IgnisRBX authored Nov 1, 2024
1 parent 64b4faf commit 64f5fcd
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions content/en-us/reference/engine/classes/Camera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
<img src="/assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.jpg" width="720" alt="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`.
<img src="../../../assets/engine-api/classes/Camera/DeviceSafeViewportCoordinates.png" width="840" alt="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,
Expand Down

0 comments on commit 64f5fcd

Please sign in to comment.