Part

Tampilkan yang Tidak Digunakan Lagi

*Konten ini diterjemahkan menggunakan AI (Beta) dan mungkin mengandung kesalahan. Untuk melihat halaman ini dalam bahasa Inggris, klik di sini.

Objek Bag adalah jenis BasePart . Ini datang dalam lima bentuk primitif yang berbeda: Bola, Blok, Silinder, Siku, dan CornerWedge.

Contoh Kode

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

Rangkuman

Properti

Properti diwarisi dari BasePartProperti diwarisi dari PVInstance

Metode

Metode diwarisi dari BasePartMetode diwarisi dari PVInstance

Acara

Acara diwarisi dari BasePart

Properti

Tidak Direplikasi
Baca Paralel

Propietas Bentuk menetapkan bentuk umum objek ke salah satu daftar bawaan bentuk bawaan.

Enam.PartType enum mengontrol nilai bentuk, dan ada lima bentuk yang mungkin:

| Bentuk/Nilai | Deskripsi | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

MeshPart dan solid modeling dapat digunakan untuk mendapatkan bentuk bagian yang benar-benar khusus.

Tabrakan antara bola, blok, dan sudut, dan sudut sudut adalah persis, sementara tabrakan antara terreno, silinder, TriangleMeshes, dan jenis geometri lainnya adalah aproximasi. Ini berarti bahwa bentuk bola dapat berguna untuk membuat tabrakan stabil untuk roda mobil.

Contoh Kode

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

Metode

Acara