学ぶ
エンジンクラス
PartOperation

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


概要
方法
継承されたメンバー

APIリファレンス
プロパティ
RenderFidelity
プラグインのセキュリティ
並列読み取り
機能: Basic, CSG
PartOperation.RenderFidelity:Enum.RenderFidelity

SmoothingAngle
プラグインのセキュリティ
並列読み取り
機能: Basic, CSG
PartOperation.SmoothingAngle:number

TriangleCount
Robloxのセキュリティ
並列読み取り
機能: Basic, CSG
PartOperation.TriangleCount:number

UsePartColor
並列読み取り
機能: Basic, CSG
PartOperation.UsePartColor:boolean

方法
SubstituteGeometry
機能: Basic, CSG
PartOperation:SubstituteGeometry(source:Instance):()
パラメータ
source:Instance
戻り値
()
コードサンプル
置き換えジオメトリとドロップ制約
local GeometryService = game:GetService("GeometryService")
local mainPart = workspace.PurpleBlock
local otherParts = { workspace.BlueBlock }
local options = {
CollisionFidelity = Enum.CollisionFidelity.Default,
RenderFidelity = Enum.RenderFidelity.Automatic,
SplitApart = false,
}
local constraintOptions = {
tolerance = 0.1,
weldConstraintPreserve = Enum.WeldConstraintPreserve.All,
}
-- pcall()内でユニオン操作を実行します。なぜなら非同期だからです
local success, newParts = pcall(function()
return GeometryService:UnionAsync(mainPart, otherParts, options)
end)
if success and #newParts > 0 and mainPart:IsA("PartOperation") then
-- 結果操作の最初の部品を置き換えに使用する部品として設定します
-- 最初の部品は単なるオプションです; これが任意のPartOperationであることもできます
local substitutePart = newParts[1]
-- 主部品の位置に部品を再配置します
substitutePart.CFrame = mainPart.CFrame
-- 保持またはドロップする制約/アタッチメントを計算します
local recommendedTable = GeometryService:CalculateConstraintsToPreserve(mainPart, newParts, constraintOptions)
-- 主部品のジオメトリを置き換えジオメトリで置き換えます
mainPart:SubstituteGeometry(substitutePart)
-- 置き換えに自動的に保持されない制約/アタッチメントをドロップします
for _, item in pairs(recommendedTable) do
if item.Attachment then
if item.ConstraintParent == nil then
item.Constraint.Parent = nil
end
if item.AttachmentParent == nil then
item.Attachment.Parent = nil
end
elseif item.WeldConstraint then
if item.Parent == nil then
item.WeldConstraint.Parent = nil
end
end
end
-- 他の部品を破壊します
for _, otherPart in pairs(otherParts) do
otherPart.Parent = nil
otherPart:Destroy()
end
end

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。