固體模型化

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

固體模型 是將 零件 以獨特的方式結合形成更複雜的形狀,稱為 聯盟交叉 的過程。您可以使用工具列的 模型 標籤內的工具執行四個固體模型操作。

Studio's Model tab with the Solid Modeling tools highlighted.
工具快捷方式說明
聯盟(Windows) (Mac)將兩個或更多零件結合成單一堅固的聯聯集。
交叉(Windows) (Mac)將重疊部件交叉到單一實體交叉點。
否定(Windows) (Mac)否定零件,用於製作孔和凹陷。
分開(Windows) (Mac)將聯盟或交集分解為其各自的部分。

聯盟零件

聯盟工具會將兩個或更多零件結合形成單一實體 。預設情況下,新聯盟會尊重每個零件的 Color 屬性,雖然您可以啟用其 UsePartColor 屬性來將整個聯盟變更為特定顏色。

Block and cylinder parts overlapping

要將零件結合成聯聯集:

  1. 選擇你想要結合的所有零件。
  2. 點擊 聯盟 按鈕。所有零件結合成一個牢固的UnionOperation,使用名稱 聯盟

交叉零件

交叉工具會將重疊部件交叉為單一實體 。預設情況下,結果交集的面顏色從原始零件的 Color 屬性中借用,雖然您可以啟用其 UsePartColor 屬性來將整個交集變更為特定顏色。

Block and cylinder parts overlapping

要一起交叉重疊零件:

  1. 選擇所有你想交叉的零件。
  2. 點擊 交叉 按鈕。所有零件都會結合成一個實體 IntersectOperation 並以名稱 交叉 來組合。

否認零件

否定工具會否認一個部分,因此當它與另一個部分結合時,否定的部分的形狀會從另一部分中減去。

Negated block overlapping a cylinder

要從其他重疊部分中減除零件:

  1. 選擇你想要否認的零件。
  2. 點擊 否定 . 零件變成 NegateOperation 以名稱 否定部分 和變成粉紅色和透明以顯示狀態。
  3. 選擇要取消的部分和你想從中減去的零件。
  4. 點擊 聯盟 。被否定的部分從包含的重疊部分中被切割。

分開聯盟或交叉點

分離工具會將分離工具分解為各自的零件,本質上可用作聯盟和交叉的"撤銷"工具。

要將聯盟或交集分解為個別零件:

  1. 選擇聯盟或交集。
  2. 點擊 分開 。零件會回到原本形狀。

渲染忠實度

預設情況下,新的模型操作總是會在 Automatic 渲染精度中顯示,這意味著零件的細節取決於它與相機的距離,如下表所述。

從相攝影機的距離渲染忠實度
少於 250 個單位最高
250-500 格中等
500 或更多個單位最低

平滑角度

一個模型固體零件的 SmoothingAngle 屬性可以平滑相同顏色或材料附近表面之間的角度。更高的值產生更平滑的外觀,而更低的值產生更粗糙的外觀,並有更多鋒利的邊緣。

雖然 30 到 70 度之間的值通常會產生良好的結果,但 90 到 180 度之間的值可能會對尖邊聯盟和交叉點造成「陰影」效果,因此不建議使用。

經驗內的固體模型化

除了 Studio 中的 聯盟交叉否認 工具外,您還可以允許玩家在體驗內使用固體建模操作通過 UnionAsync()IntersectAsync()SubtractAsync()。所有這些方法都必須在 BasePart 上呼叫,並且都需要一個或多個部分來結合、交叉或從呼叫部分中減去。

UnionAsync()

要展示 ,下列 使用工作區中的 部分1 與 部分2 、 部分3 和 部分4 結合,然後將結果的 部分 轉移到工作區的原始位置的 部分1 。


local Workspace = game:GetService("Workspace")
local mainPart = Workspace.Part1
local otherParts = {Workspace.Part2, Workspace.Part3, Workspace.Part4}
-- 執行聯合操作
local success, newUnion = pcall(function()
return mainPart:UnionAsync(otherParts)
end)
-- 如果操作成功,將它放置在同一位置並將其作為工作區的父級
if success and newUnion then
newUnion.Position = mainPart.Position
newUnion.Parent = Workspace
end
-- 摧毀操作後仍然完好的原始零件
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end

交叉异步()

要展示 ,下列 使用工作區中的 部分1 與 部分2 和 部分3 交叉,然後將結果的 部分 移到工作區的原始位置 部分1 。


local Workspace = game:GetService("Workspace")
local mainPart = Workspace.Part1
local otherParts = {Workspace.Part2, Workspace.Part3}
-- 執行交集操作
local success, newIntersect = pcall(function()
return mainPart:IntersectAsync(otherParts)
end)
-- 如果操作成功,將它放置在同一位置並將其作為工作區的父級
if success and newIntersect then
newIntersect.Position = mainPart.Position
newIntersect.Parent = Workspace
end
-- 摧毀操作後仍然完好的原始零件
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end

減除异步()

要展示 ,以下 使用工作區中的 部分1 來抵消 部分2 、 部分3 和 部分4 ,然後將結果 返回到工作區的原始位置 部分1 。


local Workspace = game:GetService("Workspace")
local mainPart = Workspace.Part1
local otherParts = {Workspace.Part2, Workspace.Part3, Workspace.Part4}
-- 執行減法操作
local success, newSubtract = pcall(function()
return mainPart:SubtractAsync(otherParts)
end)
-- 如果操作成功,將它放置在同一位置並將其作為工作區的父級
if success and newSubtract then
newSubtract.Position = mainPart.Position
newSubtract.Parent = Workspace
end
-- 摧毀操作後仍然完好的原始零件
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end