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 Bagian adalah jenis BasePart . Ini datang dalam lima bentuk primitif yang berbeda: Bola, Blok, Silinder, Pasak, 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

Properti Bentuk mengatur bentuk keseluruhan objek ke salah satu daftar prasetel dari bentuk bawaan.

The Enum.PartType enum mengontrol nilai bentuk, dan memiliki lima bentuk yang mungkin:

| Bentuk/Nilai | Deskripsi | | ----------- | --------------------------------------- | | Bola | Bentuk bulat.| | Blok | Bentuk blok.| | Silinder | Bentuk silinder.| | Pasak | Bentuk pasak dengan lereng di satu sisi.| | CornerWedge | Bentuk segi sudut dengan lereng di dua sisi. |

MeshPart dan pemodelan padat dapat digunakan untuk mendapatkan bentuk bagian yang benar-benar khusus.

Tabrakan antara bola, blok, dan pasak, serta pasak sudut adalah akurat, sementara tabrakan antara medan, silinder, TriangleMeshes, dan jenis geometri lainnya adalah aproksimasi.Ini berarti bahwa bentuk bola dapat berguna untuk membuat kolider 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