Part

显示已弃用

*此内容使用人工智能(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

方法

活动