Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
MeshLibrary
繼承: Resource < RefCounted < Object
網格庫。
說明
網格庫包含一個 Mesh 資源列表,每個資源都有一個名稱和 ID。每個專案還可以包括碰撞和導覽形狀。這個資源在 GridMap 中使用。
教學
方法
方法說明
void clear() 🔗
清除庫。
使用給定的 ID 在庫中建立一個新項。
你可以從 get_last_unused_item_id() 獲取一個未使用的 ID。
int find_item_by_name(name: String) const 🔗
Returns the first item with the given name, or -1 if no item is found.
Returns the number of items present in the library.
PackedInt32Array get_item_list() const 🔗
返回正在使用的專案 ID 列表。
Mesh get_item_mesh(id: int) const 🔗
返回該專案的網格。
ShadowCastingSetting get_item_mesh_cast_shadow(id: int) const 🔗
Returns the item's shadow casting mode.
Transform3D get_item_mesh_transform(id: int) const 🔗
返回套用到專案網格的變換。
String get_item_name(id: int) const 🔗
返回該項的名稱。
返回該項的導覽層位元遮罩。
返回該項的導覽網格。
返回套用於該項導覽網格的變換。
Texture2D get_item_preview(id: int) const 🔗
在編輯器中運作時,返回生成的專案預覽(等軸透視中的 3D 算繪)。在一個運作的項目中使用時,返回手動定義的專案預覽,該專案預覽可以使用 set_item_preview() 設定。如果在一個運作的專案中,沒有手動設定預覽,則返回一個空的 Texture2D。
Array get_item_shapes(id: int) const 🔗
返回某個專案的碰撞形狀。
該陣列由每個 Shape3D 後跟其 Transform3D 組成。
int get_last_unused_item_id() const 🔗
獲取新項未使用的 ID。
刪除專案。
void set_item_mesh(id: int, mesh: Mesh) 🔗
設定該項的網格。
void set_item_mesh_cast_shadow(id: int, shadow_casting_setting: ShadowCastingSetting) 🔗
Sets the item's shadow casting mode to shadow_casting_setting.
void set_item_mesh_transform(id: int, mesh_transform: Transform3D) 🔗
設定要套用到專案網格的變換。
void set_item_name(id: int, name: String) 🔗
設定該項的名稱。
這個名稱會顯示在編輯器中。稍後還可以使用 find_item_by_name() 來搜尋該項。
設定該項的導覽層位元遮罩。
設定該項的導覽網格。
設定套用於該項的導覽網格的變換。
void set_item_preview(id: int, texture: Texture2D) 🔗
在編輯器中設定要用作該項預覽圖示的紋理。
void set_item_shapes(id: int, shapes: Array) 🔗
設定某個專案的碰撞形狀。
該陣列應由 Shape3D 物件組成,每個物件後跟一個將套用於它的 Transform3D。對於不應具有變換的形狀,請使用 Transform3D.IDENTITY。