Skip to content

Commit 54130c1

Browse files
authored
Merge branch 'main' into Fraktality-patch-1
2 parents e19e41a + 5f88496 commit 54130c1

File tree

5 files changed

+100
-47
lines changed

5 files changed

+100
-47
lines changed
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

content/en-us/reference/engine/classes/Camera.yaml

Lines changed: 81 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ properties:
238238
viewport to its opposite corner) the camera can view. See
239239
`Class.Camera.FieldOfView|FieldOfView` for a more general explanation of
240240
field of view.
241+
242+
Note that `DiagonalFieldOfView` represents the field of view that is
243+
visible by the `Class.Camera` rendering into the fullscreen area which
244+
may be occluded by notches or screen cutouts on some devices. See `Class.
245+
Camera.ViewportSize|ViewportSize` for more information.
241246
code_samples:
242247
type: float
243248
tags:
@@ -271,6 +276,11 @@ properties:
271276
using binoculars.
272277
- Increasing FOV when the player is "sprinting" to give the impression of
273278
a lack of control.
279+
280+
Note that `FieldOfView` represents the field of view that is visible by
281+
the `Class.Camera` rendering into the fullscreen area which may be
282+
occluded by notches or screen cutouts on some devices. See `Class.Camera.
283+
ViewportSize|ViewportSize` for more information.
274284
code_samples:
275285
type: float
276286
tags: []
@@ -534,15 +544,36 @@ properties:
534544
writeCapabilities: []
535545
- name: Camera.ViewportSize
536546
summary: |
537-
Describes the dimensions, in pixels, of the client's viewport.
547+
The dimensions of the device safe area on a Roblox client.
538548
description: |
539-
**ViewportSize** describes the dimensions, in pixels, of the client's
540-
viewport.
541-
542-
This property ignores the GUI inset applied by the top bar, meaning the
543-
center of the screen can be found at precisely at 50% of the viewport in
544-
both directions. You can find the position of a `Datatype.Vector3` in the
545-
world on the viewport using `Class.Camera:WorldToViewportPoint()`.
549+
`Class.Camera.ViewportSize|ViewportSize` returns the dimensions of the
550+
device safe area on the current screen. This area is a rectangle which
551+
includes the Roblox top bar area but does not include any device notches
552+
or screen cutouts. The units of `Class.Camera.ViewportSize|ViewportSize` are Roblox
553+
UI offset units which may be different from native display pixels.
554+
555+
<img src="../../../assets/engine-api/classes/Camera/DeviceSafeAreaVsFullscreen.png" width="840" alt="Mobile device screen with cutout showing device safe area." />
556+
557+
As noted above, `Class.Camera.ViewportSize|ViewportSize` is not equal to the fullscreen
558+
area size on displays with cutouts or
559+
notches. To obtain the fullscreen area size on all displays, you can query the
560+
`Class.ScreenGui.AbsoluteSize|AbsoluteSize` property of a `Class.ScreenGui` with
561+
`Class.ScreenGui.ScreenInsets|ScreenInsets` set to `Enum.ScreenInsets.None|None`. See
562+
`Enum.ScreenInsets` for a more information about how screen areas are defined.
563+
564+
Finally, note that `Class.Camera.ViewportSize|ViewportSize` is not the actual viewport size
565+
the camera uses for rendering (the camera renders in the fullscreen area). Also, the
566+
`Class.Camera.FieldOfView` and `Class.Camera.DiagonalFieldOfView` properties are
567+
based on the fullscreen area, not `Class.Camera.ViewportSize|ViewportSize`.
568+
569+
##### Camera Updates
570+
571+
Only the `Class.Camera` currently referred to by `Class.Workspace.
572+
CurrentCamera` has its `Class.Camera.ViewportSize|ViewportSize` updated each
573+
frame during the `Class.RunService.PreRender|PreRender` step. The
574+
`Class.Camera.ViewportSize|ViewportSize` of all other cameras in your
575+
experience won't be updated, including those used for
576+
`Class.ViewportFrame|ViewportFrames`.
546577
code_samples:
547578
type: Vector2
548579
tags:
@@ -1158,26 +1189,45 @@ methods:
11581189
summary: |
11591190
Creates a unit `Datatype.Ray` from a position on the viewport (in pixels),
11601191
at a given depth from the `Class.Camera`, orientated in the camera's
1161-
direction. Does not account for the GUI inset.
1192+
direction. Does not account for the `Enum.ScreenInsets|CoreUISafeInsets` inset.
11621193
description: |
1163-
This function creates a unit `Datatype.Ray` from a 2D position on the
1164-
viewport (defined in pixels). This position does **not** account for the
1165-
GUI inset. The `Datatype.Ray` originates from the `Datatype.Vector3`
1166-
equivalent of the 2D position in the world at the given depth (in studs)
1167-
away from the `Class.Camera`.
1168-
1169-
As this function does not acknowledge the GUI inset, the viewport position
1170-
given is not equivalent to the screen position used by GUI elements. If
1171-
you are not using `Class.ScreenGui.IgnoreGuiInset` and need an otherwise
1172-
identical function that accounts for the GUI offset, use
1194+
This function creates a unit `Datatype.Ray` from a 2D position in device
1195+
safe viewport coordinates, defined in pixels. The ray originates from the
1196+
`Datatype.Vector3` equivalent of the 2D position in the world at the
1197+
given depth (in studs) away from the `Class.Camera`.
1198+
1199+
As illustrated below, `(0, 0)` corresponds to the top‑left point of the Roblox
1200+
top bar. This means that the input 2D position does **not** account for the
1201+
`Enum.ScreenInsets|CoreUISafeInsets` inset, but it does account for any
1202+
`Enum.ScreenInsets|DeviceSafeInsets`.
1203+
1204+
<img src="../../../assets/engine-api/classes/Camera/ViewportPointToRayOrigin.png" width="840" alt="Diagram showing the origin of the device safe area viewport coordinate system." />
1205+
1206+
Note that UI instances use a different coordinate system
1207+
(`Class.GuiObject.AbsolutePosition` uses the
1208+
`Enum.ScreenInsets|CoreUISafeInsets` viewport coordinate system
1209+
while this function uses the `Enum.ScreenInsets|DeviceSafeInsets`
1210+
viewport coordinate system). If you
1211+
would like to specify position in core UI coordinates, please use
11731212
`Class.Camera:ScreenPointToRay()`.
11741213
1214+
Also note that this function only works for the `Class.Workspace.
1215+
CurrentCamera` camera.
1216+
Other cameras, such as those you create for a `Class.ViewportFrame`, have
1217+
an initial viewport size of `(1, 1)` and are only updated after you set
1218+
them to `Class.Workspace.CurrentCamera|CurrentCamera`. The mismatch in
1219+
viewport size causes the camera to return a ray with an incorrect
1220+
`Datatype.Ray.Direction`.
1221+
11751222
This function can be used in conjunction with the
1176-
`Class.Camera.ViewportSize` property to create a ray from the centre of
1223+
`Class.Camera.ViewportSize|ViewportSize` property to create a ray from the centre of
11771224
the screen, for example:
11781225
11791226
```lua
1180-
local camera = workspace.CurrentCamera
1227+
local Workspace = game:GetService("Workspace")
1228+
1229+
local camera = Workspace.CurrentCamera
1230+
11811231
local viewportPoint = camera.ViewportSize / 2
11821232
local unitRay = camera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y, 0)
11831233
```
@@ -1186,33 +1236,30 @@ methods:
11861236
create a longer ray, you can do the following:
11871237
11881238
```lua
1189-
local camera = workspace.CurrentCamera
1239+
local Workspace = game:GetService("Workspace")
1240+
1241+
local camera = Workspace.CurrentCamera
1242+
11901243
local length = 500
11911244
local unitRay = camera:ScreenPointToRay(100, 100)
11921245
local extendedRay = Ray.new(unitRay.Origin, unitRay.Direction * length)
11931246
```
1194-
1195-
This function only works for the current Workspace camera. Other cameras,
1196-
such as those you create for a `Class.ViewportFrame`, have an initial
1197-
viewport size of `(1, 1)` and are only updated after you set them to
1198-
`Class.Workspace.CurrentCamera`. The mismatch in viewport size causes the
1199-
camera to return a ray with an incorrect `Datatype.Ray.Direction`.
12001247
code_samples:
12011248
parameters:
12021249
- name: x
12031250
type: float
12041251
default:
12051252
summary: |
1206-
The position on the X axis, in pixels, of the viewport point at which
1207-
to originate the `Datatype.Ray`. This position does not account for
1208-
the GUI inset.
1253+
The position on the **X** axis, in pixels, of the viewport point at
1254+
which to originate the `Datatype.Ray`, in device safe area
1255+
coordinates.
12091256
- name: 'y'
12101257
type: float
12111258
default:
12121259
summary: |
1213-
The position on the Y axis, in pixels, of the viewport point at which
1214-
to originate the `Datatype.Ray`. This position does not account for
1215-
the GUI inset.
1260+
The position on the **Y** axis, in pixels, of the viewport point at
1261+
which to originate the `Datatype.Ray`, in device safe area
1262+
coordinates.
12161263
- name: depth
12171264
type: float
12181265
default: 0

content/en-us/reference/engine/datatypes/Axes.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Axes
22
type: datatype
33
summary: |
4-
The `Datatype.Axes` data type is for the `Class.ArcHandles` class to control
4+
The `Axes` data type is for the `Class.ArcHandles` class to control
55
which rotation axes are currently enabled.
66
description: |
7-
The `Datatype.Axes` data type is for the `Class.ArcHandles` class to control
7+
The `Axes` data type is for the `Class.ArcHandles` class to control
88
which rotation axes are currently enabled.
99
code_samples:
1010
tags: []

content/en-us/studio/microprofiler/tag-table.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,27 +175,27 @@ The following is a list of common tags in the MicroProfiler, grouped by category
175175
<td>Reduce the number of visible adorned objects, such as `Class.BillboardGui|BillboardGuis`, `Class.Humanoid` name/health labels, etc.</td>
176176
</tr>
177177
<tr>
178-
<td>Prepare/Pass2D</td>
178+
<td>Prepare/Pass2d</td>
179179
<td>Readies 2D UI rendering (both player and Roblox UI).</td>
180180
<td>Reduce the amount or complexity of UI elements.</td>
181181
</tr>
182182
<tr>
183-
<td>Prepare/UpdateInvalidParts</td>
183+
<td>Prepare/UpdatePrepare/updateInvalidParts</td>
184184
<td>Updates parts that had some property changed or added.</td>
185185
<td>Reduce the amount of properties changes on the world. If a script updates a large set of object properties, break it down across frames.</td>
186186
</tr>
187187
<tr>
188-
<td>Prepare/UpdateInvalidateFastClusters</td>
188+
<td>Prepare/UpdatePrepare/updateInvalidatedFastClusters</td>
189189
<td>Prepares geometry, typically "FastClusters" used to render `Class.Humanoid|Humanoids`. Sub-markers specify the number of parts, vertices, and size of vertices.</td>
190190
<td>Reduce the use of 'Humanoids' under objects that are not `Class.Humanoid|Humanoids`. This should not be used to shorten draw calls as FastClusters consume much more memory.</td>
191191
</tr>
192192
<tr>
193-
<td>Prepare/UpdateDynamicParts</td>
193+
<td>Prepare/UpdatePrepare/updateDynamicParts</td>
194194
<td>Updates positions for `Class.Humanoid|Humanoids`, vehicles and other moving instances for rendering.</td>
195195
<td>Reduce the number or complexity of moving `Class.Humanoid|Humanoids` or vehicles visible. Combining parts of the same material and color into a union or MeshPart can help with this.</td>
196196
</tr>
197197
<tr>
198-
<td>Prepare/updateInstancedClusters</td>
198+
<td>Prepare/UpdatePrepare/updateInstancedClusters</td>
199199
<td>Prepares static geometry that uses instanced rendering (parts and mesh parts). Labels "Clusters" and "Instances" indicate the number updated.</td>
200200
<td>Use less overall mesh and material variation. You can also create clusters by using objects that have similar appearances - size, color, material. </td>
201201
</tr>
@@ -335,22 +335,22 @@ The following is a list of common tags in the MicroProfiler, grouped by category
335335
<td>Reduce the amount of joints being created or destroyed.</td>
336336
</tr>
337337
<tr>
338-
<td>Simulation/physicsStepped</td>
338+
<td>Simulation/physicsSteppedTotal/physicsStepped</td>
339339
<td>Runs the physics simulation.</td>
340340
<td>Reduce the amount and complexity of physically simulated bodies.</td>
341341
</tr>
342342
<tr>
343-
<td>physicsStepped/SpacialFilter/filterStep</td>
343+
<td>Simulation/physicsSteppedTotal/physicsStepped/SpacialFilter/filterStep</td>
344344
<td>Updates simulation islands, arranging parts according to network ownership, local simulation. Islands are non-interacting groups of parts which can be simulated independently.</td>
345345
<td>Avoid setting network ownership frequently. Keep groups of parts far enough away from each other so they can be simulated separately.</td>
346346
</tr>
347347
<tr>
348-
<td>physicsStepped/worldStep/stepContacts</td>
348+
<td>Simulation/physicsSteppedTotal/physicsStepped/worldStep/stepContacts</td>
349349
<td>Updates contacts between objects.</td>
350350
<td>Reduce the amount of bodies colliding at once, or use simpler collision boxes. Cubes are better than complex meshes.</td>
351351
</tr>
352352
<tr>
353-
<td>physicsStepped/worldStep/stepWorld OR stepWorldThrottled</td>
353+
<td>Simulation/physicsSteppedTotal/physicsStepped/worldStep/stepWorld **OR** stepWorldThrottled</td>
354354
<td>Solves physics equations relating to connectors, buoyancy and `Class.Humanoid|Humanoids`. When the engine is overloaded and unable to simulate everything in real time, some steps may be throttled (stepWorldThrottled) and only "real time assemblies" such as `Class.Humanoid|Humanoids` are simulated.</td>
355355
<td>Depends on where the time is going based on the following three phases: stepContacts: narrow phase collision detection geometry tests. Solver step: integrate time and resolve collisions and other constraints updateBroadphase: update positions of assemblies in collision detection system and find possibly colliding narrow phase pairs.</td>
356356
</tr>
@@ -360,7 +360,7 @@ The following is a list of common tags in the MicroProfiler, grouped by category
360360
<td></td>
361361
</tr>
362362
<tr>
363-
<td>Simulation/InterpolateNetworkedAssemblies</td>
363+
<td>Simulation/physicsSteppedTotal/physicsStepped/interpolateNetworkedAssemblies</td>
364364
<td>Interpolates assemblies not controlled by this network peer.</td>
365365
<td>Set the network owner of parts to this peer to reduce this; although this will usually cause more physics work to be done elsewhere.</td>
366366
</tr>
@@ -370,7 +370,7 @@ The following is a list of common tags in the MicroProfiler, grouped by category
370370
<td>Lower the destroy height or reduce the amount of parts that fall to the destroy height.</td>
371371
</tr>
372372
<tr>
373-
<td>Heartbeat/HeartbeatInternal/updateVisuallySleeping</td>
373+
<td>Heartbeat/heartbeatInternal/workspaceOnHeartbeat/updateVisuallySleeping</td>
374374
<td>Second part of NotifyMovingAssemblies.</td>
375375
<td></td>
376376
</tr>

0 commit comments

Comments
 (0)