특정 개체와 직접 관련이 없는 기하 작업이 포함된 서비스.
요약
메서드
각각의 부모와 함께 보존하도록 선택할 수 있는 Constraints 및 Attachments 테이블을 반환합니다.
하나 이상의 PartOperations 를 하나의 부품과 다른 부품의 교차 기하학에서 생성합니다.
하나 이상의 PartOperations를 다른 부품에 의해 차지되는 부분을 뺀 한 부분으로 만들어 다른 부품에 의해 차지되는 기하오메트리를 줄입니다.
하나 이상의 PartOperations를 한 부분과 다른 부분에 의해 차지된 기하학으로 만듭니다.
속성
메서드
CalculateConstraintsToPreserve
각각의 부모와 함께 보존하도록 선택할 수 있는 Constraints 및 Attachments 테이블을 반환합니다.이 테이블을 반복하면 권장 제약 조건과 부착물을 각각의 부모에 다시 연결할지 여부를 결정할 수 있습니다.
options 사전에는 팔로잉포함될 수 있습니다:
- — 부착물과 원래 부품의 표면에서 가장 가까운 지점 사이의 거리 관용도, 결과 부품의 표면에서 가장 가까운 지점과 비교하여.솔리드 모델링 작업 후 결과 거리가 이 값보다 크면 첨부 파일과 해당 제약 조건의 Parent 는 반환된 권장 테이블에서 nil 됩니다.
- — 결과 권장 테이블에서 보존되는 방법을 설명하는 열거형 값.
- — 기본값이 인 부울입니다. 로 설정하면 기본 없는 가 유지됩니다.
매개 변수
솔리드 모델링 작업이 수행된 원래 개체, 예를 들어 part 에서 UnionAsync() 입니다.
메서드의 옵션 사전:
- — 부착물과 원래 부품의 표면에서 가장 가까운 지점 사이의 거리 관용도, 결과 부품의 표면에서 가장 가까운 지점과 비교하여.솔리드 모델링 작업 후 결과 거리가 이 값보다 크면 첨부 파일과 해당 제약 조건의 Parent 는 반환된 권장 테이블에서 nil 됩니다.
- — 결과 권장 테이블에서 보존되는 방법을 설명하는 열거형 값.
- — 기본값이 인 부울입니다. 로 설정하면 기본 없는 가 유지됩니다.
반환
일반 경우 정보가 포함된 테이블 Constraints , NoCollisionConstraints , 및 WeldConstraints .Attachment 또는 Constraint 가 삭제되어야 하는 경우, 해당 부모는 nil 이 됩니다.
일반 경우 Constraints 예를 들어 HingeConstraint :
<th>유형</th></tr></thead><tbody><tr><td><code>첨부파일</code></td><td><code>클래스.attachment</code></td></tr><tr><td><code>제약 조건</code></td><td><code>클래스.제약조건</code> 또는 <code>nil</code></td></tr><tr><td><code>부착 부모</code></td><td><code>Class.BasePart</code> 또는 <code>nil</code></td></tr><tr><td><code>제약조건 부모</code></td><td><code>Class.BasePart</code> 또는 <code>nil</code></td></tr></tbody>
키 |
---|
For WeldConstraints :
<th>유형</th></tr></thead><tbody><tr><td><code>접합 제약조건</code></td><td><code>클래스.WeldConstraint</code></td></tr><tr><td><code>접합 제약 조건 부모</code></td><td><code>Class.BasePart</code> 또는 <code>nil</code></td></tr><tr><td><code>접합 제약 부품0</code></td><td><code>클래스.BasePart</code></td></tr><tr><td><code>접합 제약 조건 파트1</code></td><td><code>클래스.BasePart</code></td></tr></tbody>
키 |
---|
For NoCollisionConstraints :
<th>유형</th></tr></thead><tbody><tr><td><code>충돌 제한 없음</code></td><td><code>클래스.NoCollisionConstraint</code></td></tr><tr><td><code>충돌 제한 부모 없음</code></td><td><code>Class.BasePart</code> 또는 <code>nil</code></td></tr><tr><td><code>충돌 방지 파트 number1</code></td><td><code>클래스.BasePart</code></td></tr><tr><td><code>충돌 방지 파트1 NoCollisionConstraintPart1</code></td><td><code>클래스.BasePart</code></td></tr></tbody>
키 |
---|
코드 샘플
The following example shows how to preserve Attachments and Constraints based on a recommended table produced by CalculateConstraintsToPreserve().
local GeometryService = game:GetService("GeometryService")
local mainPart = workspace.PurpleBlock
local otherParts = { workspace.BlueBlock }
local options = {
CollisionFidelity = Enum.CollisionFidelity.Default,
RenderFidelity = Enum.RenderFidelity.Automatic,
SplitApart = true,
}
local constraintOptions = {
tolerance = 0.1,
weldConstraintPreserve = Enum.WeldConstraintPreserve.All,
dropAttachmentsWithoutConstraints = false,
}
-- Perform subtract operation in pcall() since it's asyncronous
local success, newParts = pcall(function()
return GeometryService:SubtractAsync(mainPart, otherParts, options)
end)
if success and newParts then
-- Loop through resulting parts to reparent/reposition
for _, newPart in pairs(newParts) do
newPart.Parent = mainPart.Parent
newPart.CFrame = mainPart.CFrame
newPart.Anchored = mainPart.Anchored
end
-- Calculate constraints/attachments to either preserve or drop
local recommendedTable = GeometryService:CalculateConstraintsToPreserve(mainPart, newParts, constraintOptions)
-- Preserve constraints/attachments based on recommended table
for _, item in pairs(recommendedTable) do
if item.Attachment then
item.Attachment.Parent = item.AttachmentParent
if item.Constraint then
item.Constraint.Parent = item.ConstraintParent
end
elseif item.NoCollisionConstraint then
local newNoCollision = Instance.new("NoCollisionConstraint")
newNoCollision.Part0 = item.NoCollisionPart0
newNoCollision.Part1 = item.NoCollisionPart1
newNoCollision.Parent = item.NoCollisionParent
elseif item.WeldConstraint then
local newWeldConstraint = Instance.new("WeldConstraint")
newWeldConstraint.Part0 = item.WeldConstraintPart0
newWeldConstraint.Part1 = item.WeldConstraintPart1
newWeldConstraint.Parent = item.WeldConstraintParent
end
end
-- Destroy original parts
mainPart.Parent = nil
mainPart:Destroy()
for _, otherPart in pairs(otherParts) do
otherPart.Parent = nil
otherPart:Destroy()
end
end
IntersectAsync
주 부품과 지정된 배열의 다른 부품의 교차 기하학에서 하나 이상의 PartOperations를 생성합니다.오직 기본 형식 Parts 및 PartOperations 만 지원되며, Terrain 또는 MeshParts 는 지원되지 않습니다.Clone() 와 비슷하게, 반환된 부품에는 설정된 Parent 이 없습니다.
주요 부분(part)의 다음 속성이 결과 PartOperations에 적용됩니다.
다음 이미지 비교에서는 보라색 블록과 파란색 블록이 포함된 배열을 사용하여 IntersectAsync()가 호출됩니다.결과 PartOperation 는 두 부품의 교차 기하학의 형태로 해결됩니다.

<figcaption>별도 부품</figcaption>

<figcaption>결과 클래스.PartOperation </figcaption>
노트
BasePart:IntersectAsync() 와 비교하여 이 메서드는 다음과 같이 차이가 납니다:
- 입력 부품은 배경 작업을 수행할 수 있도록 장면에 부모로 지정할 필요가 없습니다.
- SplitApart``true 설정하면 각각의 고유한 바디가 자체의 PartOperation 반환됩니다.
- 반환된 각 부품은 주 부품의 좌표 공간에 있습니다.즉, 반환된 부품의 (0, 0, 0)가 반드시 신체중심에 있지 않다는 것을 의미합니다.
- 클라이언트에서 이 메서드를 호출할 수는 있지만 몇 가지 제한이 있습니다.먼저, 현재 클라이언트에서 생성된 개체 로 수행해야 합니다 .둘째, 클라이언트에서 서버로 복제할 수 있는 기능이 없습니다.
원래 부품은 성공적인 작업 후에도 그대로 유지됩니다.대부분의 경우, 반환된 PartOperations 를 메인 부분과 동일한 위치에 부모로 지정하고, 원래 부품 모두를 Destroy() 합니다.
기본적으로 결과 PartOperations 의 얼굴 색상은 원래 부품의 Color 속성에서 빌려오지만, 특정 색상으로 변경하도록 그들의 UsePartColor 속성을 활성화할 수 있습니다.
교차 작업으로 인해 20,000개 이상의 삼각형이 생성되면 20,000으로 단순화됩니다.이로 인해 코드 -14 에 오류가 발생합니다.
작업 계산 중에 주요 부분이 이동하는 경우, 반환된 부품이 주요 부품과 동일한 좌표 공간에 있기 때문에 결과 부품을 주요 부품의 업데이트된 CFrame로 설정할 수 있습니다.
이 메서드를 주요 부분으로 PartOperation 사용하는 경우, PartOperation 를 통해 다른 SubstituteGeometry() 의 기하학을 교체하여 기하학을 사용하기 쉽지만 속성, 특성, 태그 및 주요 부분의 자식(예: Attachments , Constraints , ParticleEmitters , 라이트 개체 및 데칼)을 유지할 수 있습니다.이 접근법은 또한 원래 PartOperation를 완전히 교체하는 잠재적 "깜빡임"을 회피합니다.
매개 변수
주 Part 또는 PartOperation 에서 작동합니다.
주 부품과 교차할 부품 배열.
메서드에 대한 모든 컨트롤이 포함된 옵션 테이블:
- CollisionFidelity — 결과 부품의 CollisionFidelity 값.
- RenderFidelity — 결과 부품의 RenderFidelity 값.
- FluidFidelity — 결과 부품의 FluidFidelity 값.
- SplitApart — 개체가 모두 함께 유지되거나 적절하게 분리되어야 하는지 여부를 제어하는 부울입니다. 기본값은 true (분리)입니다.
반환
주요 부품의 교차 기하학에서 하나 이상의 및 다른 부품에서.
코드 샘플
This example intersects the geometry of mainPart and the parts in the otherParts array, splitting them into distinct PartOperations. Then it destroys the original parts involved in the operation.
local GeometryService = game:GetService("GeometryService")
local mainPart = workspace.PurpleBlock
local otherParts = { workspace.BlueBlock }
local options = {
CollisionFidelity = Enum.CollisionFidelity.Default,
RenderFidelity = Enum.RenderFidelity.Automatic,
SplitApart = true,
}
-- Perform intersect operation in pcall() since it's asyncronous
local success, newParts = pcall(function()
return GeometryService:IntersectAsync(mainPart, otherParts, options)
end)
if success and newParts then
-- Loop through resulting parts to reparent/reposition
for _, newPart in pairs(newParts) do
newPart.Parent = mainPart.Parent
newPart.CFrame = mainPart.CFrame
newPart.Anchored = mainPart.Anchored
end
-- Destroy original parts
mainPart.Parent = nil
mainPart:Destroy()
for _, otherPart in pairs(otherParts) do
otherPart.Parent = nil
otherPart:Destroy()
end
end
SubtractAsync
주 부분에서 지오메트리가 차지하는 다른 부분의 수를 뺀 주요 부분으로부터 하나 이상의 PartOperations를 생성합니다.오직 기본 형식 Parts 및 PartOperations 만 지원되며, Terrain 또는 MeshParts 는 지원되지 않습니다.Clone() 와 비슷하게, 반환된 부품에는 설정된 Parent 이 없습니다.
주요 부분(part)의 다음 속성이 결과 PartOperations에 적용됩니다.
다음 이미지 비교에서 SubtractAsync() 는 파란색 실린더와 보라색 블록이 들어있는 배열을 사용하여 호출됩니다.결과 PartOperation 는 블록의 기하학을 실린더의 것에서 생략하는 형태로 해결됩니다.

<figcaption>별도 부품</figcaption>

<figcaption>결과 클래스.PartOperation </figcaption>
노트
BasePart:SubtractAsync() 와 비교하여 이 메서드는 다음과 같이 차이가 납니다:
- 입력 부품은 배경 작업을 수행할 수 있도록 장면에 부모로 지정할 필요가 없습니다.
- SplitApart``true 설정하면 각각의 고유한 바디가 자체의 PartOperation 반환됩니다.
- 반환된 각 부품은 주 부품의 좌표 공간에 있습니다.즉, 반환된 부품의 (0, 0, 0)가 반드시 신체중심에 있지 않다는 것을 의미합니다.
- 클라이언트에서 이 메서드를 호출할 수는 있지만 몇 가지 제한이 있습니다.먼저, 현재 클라이언트에서 생성된 개체 로 수행해야 합니다 .둘째, 클라이언트에서 서버로 복제할 수 있는 기능이 없습니다.
원래 부품은 성공적인 작업 후에도 그대로 유지됩니다.대부분의 경우, 반환된 PartOperations 를 메인 부분과 동일한 위치에 부모로 지정하고, 원래 부품 모두를 Destroy() 합니다.
기본적으로 결과 PartOperations 의 얼굴 색상은 원래 부품의 Color 속성에서 빌려오지만, 특정 색상으로 변경하도록 그들의 UsePartColor 속성을 활성화할 수 있습니다.
뺄셈 작업으로 인해 20,000개 이상의 삼각형이 생성되면 20,000으로 단순화됩니다.이로 인해 코드 -14 에 오류가 발생합니다.
작업 계산 중에 주요 부분이 이동하는 경우, 반환된 부품이 주요 부품과 동일한 좌표 공간에 있기 때문에 결과 부품을 주요 부품의 업데이트된 CFrame로 설정할 수 있습니다.
이 메서드를 주요 부분으로 PartOperation 사용하는 경우, PartOperation 를 통해 다른 SubstituteGeometry() 의 기하학을 교체하여 기하학을 사용하기 쉽지만 속성, 특성, 태그 및 주요 부분의 자식(예: Attachments , Constraints , ParticleEmitters , 라이트 개체 및 데칼)을 유지할 수 있습니다.이 접근법은 또한 원래 PartOperation를 완전히 교체하는 잠재적 "깜빡임"을 회피합니다.
매개 변수
주 Part 또는 PartOperation 에서 작동합니다.
메인 부품에서 뺄 부품 배열.
메서드에 대한 모든 컨트롤이 포함된 옵션 테이블:
- CollisionFidelity — 결과 부품의 CollisionFidelity 값.
- RenderFidelity — 결과 부품의 RenderFidelity 값.
- FluidFidelity — 결과 부품의 FluidFidelity 값.
- SplitApart — 개체가 모두 함께 유지되거나 적절하게 분리되어야 하는지 여부를 제어하는 부울입니다. 기본값은 true (분리)입니다.
반환
주 부분의 기하학에서 하나 이상의 를 빼고 다른 부분에 의해 점유되는 기하학을 뺀 주 부분의 기하학.
코드 샘플
This example subtracts the geometry of the parts in the otherParts array from mainPart, splitting the results into distinct PartOperations. Then it destroys the original parts involved in the operation.
local GeometryService = game:GetService("GeometryService")
local mainPart = workspace.BlueCylinder
local otherParts = { workspace.PurpleBlock }
local options = {
CollisionFidelity = Enum.CollisionFidelity.Default,
RenderFidelity = Enum.RenderFidelity.Automatic,
SplitApart = true,
}
-- Perform subtract operation in pcall() since it's asyncronous
local success, newParts = pcall(function()
return GeometryService:SubtractAsync(mainPart, otherParts, options)
end)
if success and newParts then
-- Loop through resulting parts to reparent/reposition
for _, newPart in pairs(newParts) do
newPart.Parent = mainPart.Parent
newPart.CFrame = mainPart.CFrame
newPart.Anchored = mainPart.Anchored
end
-- Destroy original parts
mainPart.Parent = nil
mainPart:Destroy()
for _, otherPart in pairs(otherParts) do
otherPart.Parent = nil
otherPart:Destroy()
end
end
UnionAsync
주 부분과 주어진 배열에서 다른 부분에 의해 점유된 기하학을 더한 하나 이상의 PartOperations를 생성합니다.오직 기본 형식 Parts 및 PartOperations 만 지원되며, Terrain 또는 MeshParts 는 지원되지 않습니다.Clone() 와 비슷하게, 반환된 부품에는 설정된 Parent 이 없습니다.
주요 부분(part)의 다음 속성이 결과 PartOperations에 적용됩니다.
다음 이미지 비교에서 UnionAsync() 는 파란색 블록과 보라색 실린더가 들어있는 배열을 사용하여 호출됩니다.결과 PartOperation 는 두 부품의 결합 기하학의 형태로 해결됩니다.

<figcaption>별도 부품</figcaption>

<figcaption>결과 클래스.PartOperation </figcaption>
노트
BasePart:UnionAsync() 와 비교하여 이 메서드는 다음과 같이 차이가 납니다:
- 입력 부품은 배경 작업을 수행할 수 있도록 장면에 부모로 지정할 필요가 없습니다.
- SplitApart``true 설정하면 각각의 고유한 바디가 자체의 PartOperation 반환됩니다.
- 반환된 각 부품은 주 부품의 좌표 공간에 있습니다.즉, 반환된 부품의 (0, 0, 0)가 반드시 신체중심에 있지 않다는 것을 의미합니다.
- 클라이언트에서 이 메서드를 호출할 수는 있지만 몇 가지 제한이 있습니다.먼저, 현재 클라이언트에서 생성된 개체 로 수행해야 합니다 .둘째, 클라이언트에서 서버로 복제할 수 있는 기능이 없습니다.
원래 부품은 성공적인 작업 후에도 그대로 유지됩니다.대부분의 경우, 반환된 PartOperations 를 메인 부분과 동일한 위치에 부모로 지정하고, 원래 부품 모두를 Destroy() 합니다.
기본적으로 결과의 PartOperations 색상은 원래 부품의 Color 속성에서 빌려오지만, 특정 색상으로 변경하도록 UsePartColor 속성을 활성화할 수 있습니다.
연합 작업으로 인해 20,000개 이상의 삼각형이 포함된 PartOperations가 발생하면 20,000으로 간소화됩니다.이로 인해 코드 -14 에 오류가 발생합니다.
작업 계산 중에 주요 부분이 이동하는 경우, 반환된 부품이 주요 부품과 동일한 좌표 공간에 있기 때문에 결과 부품을 주요 부품의 업데이트된 CFrame로 설정할 수 있습니다.
이 메서드를 주요 부분으로 PartOperation 사용하는 경우, PartOperation 를 통해 다른 SubstituteGeometry() 의 기하학을 교체하여 기하학을 사용하기 쉽지만 속성, 특성, 태그 및 주요 부분의 자식(예: Attachments , Constraints , ParticleEmitters , 라이트 개체 및 데칼)을 유지할 수 있습니다.이 접근법은 또한 원래 PartOperation를 완전히 교체하는 잠재적 "깜빡임"을 회피합니다.
매개 변수
주 Part 또는 PartOperation 에서 작동합니다.
주 부품과 결합할 부품 배열.
메서드에 대한 모든 컨트롤이 포함된 옵션 테이블:
- CollisionFidelity — 결과 부품의 CollisionFidelity 값.
- RenderFidelity — 결과 부품의 RenderFidelity 값.
- FluidFidelity — 결과 부품의 FluidFidelity 값.
- SplitApart — 개체가 모두 함께 유지되거나 적절하게 분리되어야 하는지 여부를 제어하는 부울입니다. 기본값은 true (분리)입니다.
반환
주 부분의 기하학에서 하나 이상의 PartOperations 및 다른 부분이 차지하는 기하학을 더한 주 부분의 기하학(part).
코드 샘플
This example combines the geometry of mainPart and the parts in the otherParts array, then it destroys the original parts involved in the operation.
local GeometryService = game:GetService("GeometryService")
local mainPart = workspace.BlueBlock
local otherParts = { workspace.PurpleCylinder }
local options = {
CollisionFidelity = Enum.CollisionFidelity.Default,
RenderFidelity = Enum.RenderFidelity.Automatic,
SplitApart = false,
}
-- Perform union operation in pcall() since it's asyncronous
local success, newParts = pcall(function()
return GeometryService:UnionAsync(mainPart, otherParts, options)
end)
if success and newParts then
-- Loop through resulting parts to reparent/reposition
for _, newPart in pairs(newParts) do
newPart.Parent = mainPart.Parent
newPart.CFrame = mainPart.CFrame
newPart.Anchored = mainPart.Anchored
end
-- Destroy original parts
mainPart.Parent = nil
mainPart:Destroy()
for _, otherPart in pairs(otherParts) do
otherPart.Parent = nil
otherPart:Destroy()
end
end