Skip to content

Commit 0a60663

Browse files
update Open Source Docs from Roblox internal teams
1 parent 2dcfa06 commit 0a60663

File tree

1 file changed

+41
-27
lines changed

1 file changed

+41
-27
lines changed

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

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,42 @@ memory_category: Instances
55
summary: |
66
Instance which allows for the runtime creation and manipulation of meshes.
77
description: |
8-
`EditableMesh` changes the applied visual mesh when linked to a
8+
`Class.EditableMesh` changes the applied visual mesh when linked to a
99
`Class.MeshPart`, allowing for querying and modification of the mesh both in
1010
Studio and in experience.
1111
12-
An `EditableMesh` can be created from an existing `Datatype.Content` of a
12+
An `Class.EditableMesh` can be created from an existing `Datatype.Content` of a
1313
`Class.MeshPart` or a mesh ID using
14-
`Class.AssetService:CreateEditableMeshAsync()`, or a blank `EditableMesh` can
14+
`Class.AssetService:CreateEditableMeshAsync()`, or a blank `Class.EditableMesh` can
1515
be created with `Class.AssetService:CreateEditableMesh()`. It can then be
1616
displayed, modified, and its collision model updated. Not all of the steps are
17-
necessary; for example, you might want to create an `EditableMesh` just to
17+
necessary; for example, you might want to create an `Class.EditableMesh` just to
1818
raycast without ever displaying it.
1919
20-
An `EditableMesh` is displayed when it's linked to a new `Class.MeshPart`,
20+
An `Class.EditableMesh` is displayed when it's linked to a new `Class.MeshPart`,
2121
through `Class.AssetService:CreateMeshPartAsync()`. You can create more
22-
`Class.MeshPart` instances that reference the same `EditableMesh` content, or
22+
`Class.MeshPart` instances that reference the same `Class.EditableMesh` content, or
2323
link to an existing `Class.MeshPart` through `Class.MeshPart:ApplyMesh()`.
2424
25-
Calling `Class.AssetService:CreateMeshPartAsync()` will recalculate collision
26-
and fluid geometry with any edits and update the existing `Class.MeshPart`. It
27-
is generally recommended to do this at the end of a conceptual edit operation.
28-
`Class.MeshPart:ApplyMesh()` will update the colission and fluid geometry of
29-
the target `Class.MeshPart`.
25+
To recalculate collision and fluid geometry after editing, you can again call
26+
`Class.AssetService:CreateMeshPartAsync()` and `Class.MeshPart:ApplyMesh()`
27+
to update an existing `Class.MeshPart`. It's generally recommended to do this
28+
at the end of a conceptual edit, not after individual calls to methods that
29+
manipulate geometry. Visual changes to the mesh will always be immediately
30+
reflected by the engine, without the need to call
31+
`Class.AssetService:CreateMeshPartAsync()`.
3032
31-
#### Enabling EditableMesh for Published Experiences
33+
##### Enabling EditableMesh for Published Experiences
34+
3235
For security purposes, using `Class.EditableMesh` fails by default for published
33-
experiences. To enable the use
34-
of `Class.EditableMesh`, you must be 13+ age verified and ID verified. After you are
35-
verified, open Studio. Select **File > Game Settings > Security** and enable the
36-
**Allow Mesh & Image APIs** toggle. Remember to review the Terms of Use before
37-
enabling the toggle.
36+
experiences. To enable usage, `Class.EditableMesh`, you must be 13+ age verified
37+
and ID verified. After you are verified, open Studio's
38+
[Game Settings](../../../studio/game-settings.md), select **Security**, and
39+
enable the **Allow Mesh & Image APIs** toggle. Remember to
40+
review the [Terms of Use](https://en.help.roblox.com/hc/en-us/articles/115004647846-Roblox-Terms-of-Use#creators-restrictions-on-use) before enabling the toggle.
3841
39-
#### Permissions
42+
##### Permissions
43+
4044
To prevent misuse, `Class.AssetService:CreateEditableMeshAsync()` will only
4145
allow you to load and edit mesh assets:
4246
@@ -48,22 +52,30 @@ description: |
4852
4953
The APIs throw an error if they are used to load an asset that does
5054
not meet the criteria above.
55+
56+
##### Fixed-Size Meshes
5157
52-
#### Stable Vertex/Face IDs
58+
When creating an `Class.EditableMesh` from an existing mesh asset (via
59+
`Class.AssetService:CreateEditableMeshAsync()`), the resulting editable mesh
60+
is fixed-size by default. Fixed-size meshes are more efficient in terms of memory
61+
but you cannot change the number of vertices, faces, or attributes. Only the values
62+
of vertex attributes and positions can be edited.
5363
54-
Many `EditableMesh` methods take **vertex**, **normal**, **UV**, **color** and
64+
##### Stable Vertex/Face IDs
65+
66+
Many `Class.EditableMesh` methods take **vertex**, **normal**, **UV**, **color** and
5567
**face** IDs. These are represented as integers in Luau but they require some
5668
special handling. The main difference is that IDs are stable and they remain
5769
the same even if other parts of the mesh change. For example, if an
58-
`EditableMesh` has five vertices `{1, 2, 3, 4, 5}` and you remove vertex `4`,
70+
`Class.EditableMesh` has five vertices `{1, 2, 3, 4, 5}` and you remove vertex `4`,
5971
the new vertices will be `{1, 2, 3, 5}`.
6072
6173
Note that the IDs are not guaranteed to be in order and there may be holes in
6274
the numbering, so when iterating through vertices or faces, you should iterate
6375
through the table returned by `Class.EditableMesh:GetVertices()|GetVertices()`
6476
or `Class.EditableMesh:GetFaces()|GetFaces()`.
6577
66-
#### Split Vertex Attributes
78+
##### Split Vertex Attributes
6779
6880
A **vertex** is a corner of a face, and topologically connects faces together.
6981
Vertices can have several attributes: position, normal, UV coordinate, color,
@@ -120,7 +132,7 @@ description: |
120132
end
121133
```
122134
123-
#### Winding
135+
##### Winding
124136
125137
Mesh faces have a front side and a back side. When drawing meshes, only the
126138
front of the faces are drawn by default, although you can change this by
@@ -132,9 +144,9 @@ description: |
132144
133145
<img src="../../../assets/engine-api/classes/EditableMesh/Winding.png" alt="Order of the vertices around the face" width="550" />
134146
135-
#### Limitations
147+
##### Limitations
136148
137-
`EditableMesh` currently has a limit of 60,000 vertices and 20,000 triangles.
149+
`Class.EditableMesh` currently has a limit of 60,000 vertices and 20,000 triangles.
138150
Attempting to add too many vertices or triangles will cause an error.
139151
code_samples: []
140152
inherits:
@@ -308,8 +320,10 @@ methods:
308320
capabilities: []
309321
writeCapabilities: []
310322
- name: EditableMesh:Destroy
311-
summary: ''
312-
description: ''
323+
summary: |
324+
Destroys the mesh.
325+
description: |
326+
Destroys the contents of the mesh, immediately reclaiming used memory.
313327
code_samples: []
314328
parameters: []
315329
returns:

0 commit comments

Comments
 (0)