1 Star 1 Fork 0

天天编程/godot-docs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
class_meshlibrary.rst 12.83 KB
一键复制 编辑 原始数据 按行查看 历史
github_url: hide

MeshLibrary

Inherits: :ref:`Resource<class_Resource>` < :ref:`Reference<class_Reference>` < :ref:`Object<class_Object>`

Library of meshes.

Description

A library of meshes. Contains a list of :ref:`Mesh<class_Mesh>` resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in :ref:`GridMap<class_GridMap>`.

Methods

void :ref:`clear<class_MeshLibrary_method_clear>` ( )
void :ref:`create_item<class_MeshLibrary_method_create_item>` ( :ref:`int<class_int>` id )
:ref:`int<class_int>` :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>` ( :ref:`String<class_String>` name ) const
:ref:`PackedInt32Array<class_PackedInt32Array>` :ref:`get_item_list<class_MeshLibrary_method_get_item_list>` ( ) const
:ref:`Mesh<class_Mesh>` :ref:`get_item_mesh<class_MeshLibrary_method_get_item_mesh>` ( :ref:`int<class_int>` id ) const
:ref:`String<class_String>` :ref:`get_item_name<class_MeshLibrary_method_get_item_name>` ( :ref:`int<class_int>` id ) const
:ref:`NavigationMesh<class_NavigationMesh>` :ref:`get_item_navmesh<class_MeshLibrary_method_get_item_navmesh>` ( :ref:`int<class_int>` id ) const
:ref:`Transform<class_Transform>` :ref:`get_item_navmesh_transform<class_MeshLibrary_method_get_item_navmesh_transform>` ( :ref:`int<class_int>` id ) const
:ref:`Texture2D<class_Texture2D>` :ref:`get_item_preview<class_MeshLibrary_method_get_item_preview>` ( :ref:`int<class_int>` id ) const
:ref:`Array<class_Array>` :ref:`get_item_shapes<class_MeshLibrary_method_get_item_shapes>` ( :ref:`int<class_int>` id ) const
:ref:`int<class_int>` :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>` ( ) const
void :ref:`remove_item<class_MeshLibrary_method_remove_item>` ( :ref:`int<class_int>` id )
void :ref:`set_item_mesh<class_MeshLibrary_method_set_item_mesh>` ( :ref:`int<class_int>` id, :ref:`Mesh<class_Mesh>` mesh )
void :ref:`set_item_name<class_MeshLibrary_method_set_item_name>` ( :ref:`int<class_int>` id, :ref:`String<class_String>` name )
void :ref:`set_item_navmesh<class_MeshLibrary_method_set_item_navmesh>` ( :ref:`int<class_int>` id, :ref:`NavigationMesh<class_NavigationMesh>` navmesh )
void :ref:`set_item_navmesh_transform<class_MeshLibrary_method_set_item_navmesh_transform>` ( :ref:`int<class_int>` id, :ref:`Transform<class_Transform>` navmesh )
void :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>` ( :ref:`int<class_int>` id, :ref:`Texture2D<class_Texture2D>` texture )
void :ref:`set_item_shapes<class_MeshLibrary_method_set_item_shapes>` ( :ref:`int<class_int>` id, :ref:`Array<class_Array>` shapes )

Method Descriptions

  • void clear ( )

Clears the library.


Creates a new item in the library with the given ID.

You can get an unused ID from :ref:`get_last_unused_item_id<class_MeshLibrary_method_get_last_unused_item_id>`.


Returns the first item with the given name.


Returns the list of item IDs in use.


Returns the item's mesh.


Returns the item's name.


Returns the item's navigation mesh.


Returns the transform applied to the item's navigation mesh.


When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using :ref:`set_item_preview<class_MeshLibrary_method_set_item_preview>`. Returns an empty :ref:`Texture2D<class_Texture2D>` if no preview was manually set in a running project.


Returns an item's collision shapes.

The array consists of each :ref:`Shape<class_Shape>` followed by its :ref:`Transform<class_Transform>`.


Gets an unused ID for a new item.


Removes the item.


Sets the item's mesh.


Sets the item's name.

This name is shown in the editor. It can also be used to look up the item later using :ref:`find_item_by_name<class_MeshLibrary_method_find_item_by_name>`.


Sets the item's navigation mesh.


Sets the transform to apply to the item's navigation mesh.


Sets a texture to use as the item's preview icon in the editor.


Sets an item's collision shapes.

The array should consist of :ref:`Shape<class_Shape>` objects, each followed by a :ref:`Transform<class_Transform>` that will be applied to it. For shapes that should not have a transform, use :ref:`Transform.IDENTITY<class_Transform_constant_IDENTITY>`.

Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ttcode-net/godot-docs.git
git@gitee.com:ttcode-net/godot-docs.git
ttcode-net
godot-docs
godot-docs
master

搜索帮助