GeometryService
Service containing geometric operations.
Memory category | Instances |
---|
Member index 5
Removed member index 1
History | Member | |
---|---|---|
652 | StitchMeshesAsync(meshParts: Array): ContentId |
Description
Service containing geometric operations not directly related to specific objects.
History 22
- 652 Remove StitchMeshesAsync
- 645 Change ReturnType of StitchMeshesAsync from Content to ContentId
- 645 Change Parameters of HashMeshAsync from (meshId: Content) to (meshId: ContentId)
- 600 Add StitchMeshesAsync
- 600 Add HashMeshAsync
- 598 Change ReturnType of UnionAsync from Objects to Array
- 598 Change Parameters of UnionAsync from (part: Instance, parts: Objects, options: Dictionary = nil) to (part: Instance, parts: Array, options: Dictionary = nil)
- 598 Change ReturnType of SubtractAsync from Objects to Array
- 598 Change Parameters of SubtractAsync from (part: Instance, parts: Objects, options: Dictionary = nil) to (part: Instance, parts: Array, options: Dictionary = nil)
- 598 Change ReturnType of IntersectAsync from Objects to Array
- 598 Change Parameters of IntersectAsync from (part: Instance, parts: Objects, options: Dictionary = nil) to (part: Instance, parts: Array, options: Dictionary = nil)
- 598 Change Parameters of CalculateConstraintsToPreserve from (source: Instance, destination: Objects, options: Dictionary = nil) to (source: Instance, destination: Array, options: Dictionary = nil)
- 591 Change Parameters of UnionAsync from (part: Instance, parts: Objects, options: Variant) to (part: Instance, parts: Objects, options: Dictionary = nil)
- 591 Change Parameters of SubtractAsync from (part: Instance, parts: Objects, options: Variant) to (part: Instance, parts: Objects, options: Dictionary = nil)
- 591 Change Parameters of IntersectAsync from (part: Instance, parts: Objects, options: Variant) to (part: Instance, parts: Objects, options: Dictionary = nil)
- 591 Change Parameters of CalculateConstraintsToPreserve from (source: Instance, destination: Objects, options: Variant) to (source: Instance, destination: Objects, options: Dictionary = nil)
- 590 Change ReturnType of CalculateConstraintsToPreserve from Dictionary to Array
- 581 Add UnionAsync
- 581 Add SubtractAsync
- 581 Add IntersectAsync
- 581 Add CalculateConstraintsToPreserve
- 581 Add GeometryService
Members 5
CalculateConstraintsToPreserve
Parameters (3) | Default | |
---|---|---|
source | Instance | |
destination | Array | |
options | Dictionary | nil |
Returns (1) | ||
Array |
Returns a table of Constraints and Attachments which you may choose to preserve, along with their respective parents. Iterating over this table lets you decide whether to reparent recommended constraints and attachments to their respective parents.
Note that the options
table can contain a tolerance
value (number)
and/or a WeldConstraintPreserve
value (WeldConstraintPreserve).
tolerance
– The distance tolerance, in regards to Attachment preservation, between the attachment and the closest point on the original part's surface versus the closest point on the resulting part's surface. If the resulting distance following the solid modeling operation is greater than this value, the Parent of attachments and their associated constraints will benil
in the returned recommendation table.weldConstraintPreserve
– A WeldConstraintPreserve enum value describing how WeldConstraints are preserved in the resulting recommendation table.
Thread safety | Unsafe |
---|
History 4
- 598 Change Parameters of CalculateConstraintsToPreserve from (source: Instance, destination: Objects, options: Dictionary = nil) to (source: Instance, destination: Array, options: Dictionary = nil)
- 591 Change Parameters of CalculateConstraintsToPreserve from (source: Instance, destination: Objects, options: Variant) to (source: Instance, destination: Objects, options: Dictionary = nil)
- 590 Change ReturnType of CalculateConstraintsToPreserve from Dictionary to Array
- 581 Add CalculateConstraintsToPreserve
HashMeshAsync
Parameters (1) | ||
---|---|---|
meshId | ContentId | |
Returns (1) | ||
string |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 645 Change Parameters of HashMeshAsync from (meshId: Content) to (meshId: ContentId)
- 600 Add HashMeshAsync
IntersectAsync
Parameters (3) | Default | |
---|---|---|
part | Instance | |
parts | Array | |
options | Dictionary | nil |
Returns (1) | ||
Array |
Creates one or more PartOperations from the intersecting geometry of the main part and other parts in the given array. Only primitive Parts and PartOperations are supported, not Terrain or MeshParts. Similar to Clone(), the returned parts have no set Parent.
The following properties from the main part (part
) are applied to the
resulting PartOperations:
- Color, Material, MaterialVariant, Reflectance, Transparency
- CanCollide
- Anchored, Density, Elasticity, ElasticityWeight, Friction, FrictionWeight
In the following image comparison, IntersectAsync() is called using the purple block and an array containing the blue block. The resulting PartOperation resolves into a shape of the intersecting geometry of both parts.
Notes
Compared to BasePart:IntersectAsync(), this method differs as follows:
- The input parts do not need to be parented to the scene, allowing for background operations.
- When the
SplitApart
option is set totrue
(default), each distinct body will be returned in its own PartOperation. - Each of the returned parts are in the coordinate space of the main part. This means that the (0, 0, 0) of any returned part is not necessarily at the center of its body.
- It's possible to call this method on the client, but with some limitations. First, it currently must be done with objects created on the client. Secondly, there is no replication available from client to the server.
The original parts remain intact following a successful operation. In most cases, you should parent the returned PartOperations to the same place as the main part, then Destroy() all of the original parts.
By default, the face colors of the resulting PartOperations are borrowed from the Color property of the original parts, although you can enable their UsePartColor property to change them to a specific color.
If an intersect operation would result in any PartOperations with more than 20,000 triangles, they will be simplified to 20,000. This will result in an error with code
-14
.If the main part is moving during the calculation of the operation, you can set the resulting parts to the updated CFrame of the main part, since the returned parts are in the same coordinate space as the main part.
If using this method with a PartOperation as the main part, you can substitute the geometry of another PartOperation via SubstituteGeometry(), making it easier to utilize the geometry of the operation but maintain properties, attributes, tags, and children of the main part such as Attachments, Constraints, ParticleEmitters, light objects, and decals. This approach also circumvents the potential "flicker" of completely replacing the original PartOperation with another.
Thread safety | Unsafe |
---|
History 4
- 598 Change ReturnType of IntersectAsync from Objects to Array
- 598 Change Parameters of IntersectAsync from (part: Instance, parts: Objects, options: Dictionary = nil) to (part: Instance, parts: Array, options: Dictionary = nil)
- 591 Change Parameters of IntersectAsync from (part: Instance, parts: Objects, options: Variant) to (part: Instance, parts: Objects, options: Dictionary = nil)
- 581 Add IntersectAsync
SubtractAsync
Parameters (3) | Default | |
---|---|---|
part | Instance | |
parts | Array | |
options | Dictionary | nil |
Returns (1) | ||
Array |
Creates one or more PartOperations from the main part minus the geometry occupied by other parts in the given array. Only primitive Parts and PartOperations are supported, not Terrain or MeshParts. Similar to Clone(), the returned parts have no set Parent.
The following properties from the main part (part
) are applied to the
resulting PartOperations:
- Color, Material, MaterialVariant, Reflectance, Transparency
- CanCollide
- Anchored, Density, Elasticity, ElasticityWeight, Friction, FrictionWeight
In the following image comparison, SubtractAsync() is called using the blue cylinder and an array containing the purple block. The resulting PartOperation resolves into a shape that omits the block's geometry from that of the cylinder.
Notes
Compared to BasePart:SubtractAsync(), this method differs as follows:
- The input parts do not need to be parented to the scene, allowing for background operations.
- When the
SplitApart
option is set totrue
(default), each distinct body will be returned in its own PartOperation. - Each of the returned parts are in the coordinate space of the main part. This means that the (0, 0, 0) of any returned part is not necessarily at the center of its body.
- It's possible to call this method on the client, but with some limitations. First, it currently must be done with objects created on the client. Secondly, there is no replication available from client to the server.
The original parts remain intact following a successful operation. In most cases, you should parent the returned PartOperations to the same place as the main part, then Destroy() all of the original parts.
By default, the face colors of the resulting PartOperations are borrowed from the Color property of the original parts, although you can enable their UsePartColor property to change them to a specific color.
If a subtract operation would result in any PartOperations with more than 20,000 triangles, they will be simplified to 20,000. This will result in an error with code
-14
.If the main part is moving during the calculation of the operation, you can set the resulting parts to the updated CFrame of the main part, since the returned parts are in the same coordinate space as the main part.
If using this method with a PartOperation as the main part, you can substitute the geometry of another PartOperation via SubstituteGeometry(), making it easier to utilize the geometry of the operation but maintain properties, attributes, tags, and children of the main part such as Attachments, Constraints, ParticleEmitters, light objects, and decals. This approach also circumvents the potential "flicker" of completely replacing the original PartOperation with another.
Thread safety | Unsafe |
---|
History 4
- 598 Change ReturnType of SubtractAsync from Objects to Array
- 598 Change Parameters of SubtractAsync from (part: Instance, parts: Objects, options: Dictionary = nil) to (part: Instance, parts: Array, options: Dictionary = nil)
- 591 Change Parameters of SubtractAsync from (part: Instance, parts: Objects, options: Variant) to (part: Instance, parts: Objects, options: Dictionary = nil)
- 581 Add SubtractAsync
UnionAsync
Parameters (3) | Default | |
---|---|---|
part | Instance | |
parts | Array | |
options | Dictionary | nil |
Returns (1) | ||
Array |
Creates one or more PartOperations from the main part plus the geometry occupied by other parts in the given array. Only primitive Parts and PartOperations are supported, not Terrain or MeshParts. Similar to Clone(), the returned parts have no set Parent.
The following properties from the main part (part
) are applied to the
resulting PartOperations:
- Color, Material, MaterialVariant, Reflectance, Transparency
- CanCollide
- Anchored, Density, Elasticity, ElasticityWeight, Friction, FrictionWeight
In the following image comparison, UnionAsync() is called using the blue block and an array containing the purple cylinder. The resulting PartOperation resolves into a shape of the combined geometry of both parts.
Notes
Compared to BasePart:UnionAsync(), this method differs as follows:
- The input parts do not need to be parented to the scene, allowing for background operations.
- When the
SplitApart
option is set totrue
(default), each distinct body will be returned in its own PartOperation. - Each of the returned parts are in the coordinate space of the main part. This means that the (0, 0, 0) of any returned part is not necessarily at the center of its body.
- It's possible to call this method on the client, but with some limitations. First, it currently must be done with objects created on the client. Secondly, there is no replication available from client to the server.
The original parts remain intact following a successful operation. In most cases, you should parent the returned PartOperations to the same place as the main part, then Destroy() all of the original parts.
By default, the colors of the resulting PartOperations are borrowed from the Color property of the original parts, although you can enable their UsePartColor property to change them to a specific color.
If a union operation would result in any PartOperations with more than 20,000 triangles, they will be simplified to 20,000. This will result in an error with code
-14
.If the main part is moving during the calculation of the operation, you can set the resulting parts to the updated CFrame of the main part, since the returned parts are in the same coordinate space as the main part.
If using this method with a PartOperation as the main part, you can substitute the geometry of another PartOperation via SubstituteGeometry(), making it easier to utilize the geometry of the operation but maintain properties, attributes, tags, and children of the main part such as Attachments, Constraints, ParticleEmitters, light objects, and decals. This approach also circumvents the potential "flicker" of completely replacing the original PartOperation with another.
Thread safety | Unsafe |
---|
History 4
- 598 Change ReturnType of UnionAsync from Objects to Array
- 598 Change Parameters of UnionAsync from (part: Instance, parts: Objects, options: Dictionary = nil) to (part: Instance, parts: Array, options: Dictionary = nil)
- 591 Change Parameters of UnionAsync from (part: Instance, parts: Objects, options: Variant) to (part: Instance, parts: Objects, options: Dictionary = nil)
- 581 Add UnionAsync
Removed members 1
StitchMeshesAsync
Parameters (1) | ||
---|---|---|
meshParts | Array | |
Returns (1) | ||
ContentId |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 652 Remove StitchMeshesAsync
- 645 Change ReturnType of StitchMeshesAsync from Content to ContentId
- 600 Add StitchMeshesAsync