Reference API Roblox

Engine API

Website

Related

Reference API Roblox

GeometryService

Service containing geometric operations.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 5

HistoryMember
598CalculateConstraintsToPreserve(source: Instance, destination: Array, options: Dictionary = nil): Array
645HashMeshAsync(meshId: ContentId): string
598IntersectAsync(part: Instance, parts: Array, options: Dictionary = nil): Array
598SubtractAsync(part: Instance, parts: Array, options: Dictionary = nil): Array
598UnionAsync(part: Instance, parts: Array, options: Dictionary = nil): Array
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Removed member index 1

HistoryMember
652StitchMeshesAsync(meshParts: Array): ContentId

Description

Service containing geometric operations not directly related to specific objects.

History 22

Members 5

CalculateConstraintsToPreserve

Parameters (3)Default
sourceInstance
destinationArray
optionsDictionarynil
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 be nil in the returned recommendation table.
  • weldConstraintPreserve – A WeldConstraintPreserve enum value describing how WeldConstraints are preserved in the resulting recommendation table.

History 4

HashMeshAsync

Parameters (1)
meshIdContentId
Returns (1)
string
This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

IntersectAsync

Parameters (3)Default
partInstance
partsArray
optionsDictionarynil
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:

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.

Two block parts overlapping
Separate parts
Parts intersected into a new solid model
Resulting PartOperation

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 to true (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.

This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields]

SubtractAsync

Parameters (3)Default
partInstance
partsArray
optionsDictionarynil
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:

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.

Longer block overlapping a cylinder
Separate parts
Block part subtracted from cylinder
Resulting PartOperation

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 to true (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.

This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields]

UnionAsync

Parameters (3)Default
partInstance
partsArray
optionsDictionarynil
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:

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.

Block and cylinder parts overlapping
Separate parts
Parts joined together into a single solid union
Resulting PartOperation

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 to true (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.

This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields]

Removed members 1

StitchMeshesAsync

Parameters (1)
meshPartsArray
Returns (1)
ContentId
This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

Settings