Part

顯示已棄用項目

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

零件對象是 BasePart 的一種類型。它有五種不同的原始形狀:球、方塊、圓筒、楔子和角楔子。

範例程式碼

The script below spawns a new Part instance and sets several of the part's properties.

Most notably, the script sets the Part.Shape property to Enum.PartType.Ball. It also names the part JurassicPart, anchors it, makes it a child of Workspace, and sets its color to white.

Create a Part in a Script

local part = Instance.new("Part")
part.Name = "JurassicPart"
part.Anchored = true
part.Shape = Enum.PartType.Ball
part.Color = Color3.new(1, 1, 1)
part.Parent = workspace -- Put the part into the Workspace

概要

屬性

屬性 繼承自 BasePart屬性 繼承自 PVInstance

方法

方法 繼承自 BasePart方法 繼承自 PVInstance
  • 平行寫入

    獲得 PVInstance 的軸心。

  • PivotTo(targetCFrame : CFrame):()

    將 以及所有其子孫 轉換為指定的 位置,使旋轉點現在位於指定的 位置。

活動

活動 繼承自 BasePart

屬性

未複製
平行讀取

形狀屬性將對象的整體形狀設為預設的一個列表中的內建形狀之一。

枚列 Enum.PartType 控制形狀值,並有五種可能的形狀:

| 形狀/值 | 說明 | | ----------- | --------------------------------------- | | 球 | 球形狀。| | 方塊 | 方塊形狀。| | 筒體 | 筒體形狀。| | 楔子 | 一邊坡度的楔子形狀。| |角斜坡|兩面都有斜坡的角斜坡。|

MeshPart固體模型 可用於獲得完全自定义零件形狀。

球、方塊和楔子之間的碰撞精確,而地形、圓筒、三角網格和其他幾何類型之間的碰撞是近似的。這意味著球形狀可能有用於創建穩定的輪圈碰撞器。

範例程式碼

The script below spawns a new Part instance and sets several of the part's properties.

Most notably, the script sets the Part.Shape property to Enum.PartType.Ball. It also names the part JurassicPart, anchors it, makes it a child of Workspace, and sets its color to white.

Create a Part in a Script

local part = Instance.new("Part")
part.Name = "JurassicPart"
part.Anchored = true
part.Shape = Enum.PartType.Ball
part.Color = Color3.new(1, 1, 1)
part.Parent = workspace -- Put the part into the Workspace

方法

活動