跳转至

MeshInstance

继承

GeometryInstance

简要描述

实例化网格到场景中的节点。

描述

MeshInstance是一个采用Mesh资源并将其通过创建实例添加到当前场景的节点。这是一个最常用来渲染3D几何图形的类,可以在很多地方实例一个单一的网格。这允许重用几何图形并节省资源。当一个Mesh必须在近距离被实例上千次时,考虑在MultiMeshInstance中使用MultiMesh代替。

成员

类型 属性名 默认值
Mesh mesh
NodePath skeleton NodePath("..")
Skin skin

方法

返回值类型 方法名称
void create_convex_collision()
void create_debug_tangents()
void create_trimesh_collision()
Material get_surface_material(surface: int) const
int get_surface_material_count() const
void set_surface_material(surface: int, material: Material)

常量

成员说明

  • Mesh mesh
setter set_mesh(value)
getter get_mesh
  • NodePath skeleton
Default NodePath("..")
setter set_skeleton_path(value)
getter get_skeleton_path
  • Skin skin
setter set_skin(value)
getter get_skin

方法说明

  • create_convex_collision create_convex_collision()

辅助创建一个StaticBody子节点,该子节点具有根据网格几何体计算出的ConvexPolygonShape碰撞形状的能力。


  • create_debug_tangents create_debug_tangents()

辅助创建一个MeshInstance子节点,该子节点在从网格几何体计算出的每个顶点上都有小控件。


  • create_trimesh_collision create_trimesh_collision()

辅助创建一个StaticBody子节点,该子节点具有根据网格几何体计算出的ConcavePolygonShape碰撞形状的能力。


  • get_surface_material get_surface_material(surface: int) const

返回Mesh资源表面的Material


  • get_surface_material_count get_surface_material_count() const

返回表面材料的数量。


  • set_surface_material set_surface_material(surface: int, material: Material)

Mesh资源的表面设置Material