class_meshinstance.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. .. _class_MeshInstance:
  2. MeshInstance
  3. ============
  4. **Inherits:** :ref:`GeometryInstance<class_geometryinstance>` **<** :ref:`VisualInstance<class_visualinstance>` **<** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  5. **Category:** Core
  6. Brief Description
  7. -----------------
  8. Node that instances meshes into a :ref:`Scenario<class_scenario>`.
  9. Member Functions
  10. ----------------
  11. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  12. | void | :ref:`set_mesh<class_MeshInstance_set_mesh>` **(** :ref:`Mesh<class_mesh>` mesh **)** |
  13. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`Mesh<class_mesh>` | :ref:`get_mesh<class_MeshInstance_get_mesh>` **(** **)** const |
  15. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`set_skeleton_path<class_MeshInstance_set_skeleton_path>` **(** :ref:`NodePath<class_nodepath>` skeleton_path **)** |
  17. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`NodePath<class_nodepath>` | :ref:`get_skeleton_path<class_MeshInstance_get_skeleton_path>` **(** **)** |
  19. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`AABB<class_aabb>` | :ref:`get_aabb<class_MeshInstance_get_aabb>` **(** **)** const |
  21. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`create_trimesh_collision<class_MeshInstance_create_trimesh_collision>` **(** **)** |
  23. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`create_convex_collision<class_MeshInstance_create_convex_collision>` **(** **)** |
  25. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------+
  26. Description
  27. -----------
  28. MeshInstance is a :ref:`Node<class_node>` that takes a :ref:`Mesh<class_mesh>` resource and adds it to the current :ref:`Scenario<class_scenario>` by creating an instance of it. This is the class most often used to get 3D geometry rendered and can be used to instance a single :ref:`Mesh<class_mesh>` in many places. This allows to reuse geometry and save on resources. When a :ref:`Mesh<class_mesh>` has to be instanced more than thousands of times at close proximity, consider using a :ref:`MultiMesh<class_multimesh>` in a :ref:`MultiMeshInstance<class_multimeshinstance>` instead.
  29. Member Function Description
  30. ---------------------------
  31. .. _class_MeshInstance_set_mesh:
  32. - void **set_mesh** **(** :ref:`Mesh<class_mesh>` mesh **)**
  33. Set the :ref:`Mesh<class_mesh>` resource for the instance.
  34. .. _class_MeshInstance_get_mesh:
  35. - :ref:`Mesh<class_mesh>` **get_mesh** **(** **)** const
  36. Return the current :ref:`Mesh<class_mesh>` resource for the instance.
  37. .. _class_MeshInstance_set_skeleton_path:
  38. - void **set_skeleton_path** **(** :ref:`NodePath<class_nodepath>` skeleton_path **)**
  39. .. _class_MeshInstance_get_skeleton_path:
  40. - :ref:`NodePath<class_nodepath>` **get_skeleton_path** **(** **)**
  41. .. _class_MeshInstance_get_aabb:
  42. - :ref:`AABB<class_aabb>` **get_aabb** **(** **)** const
  43. Return the AABB of the mesh, in local coordinates.
  44. .. _class_MeshInstance_create_trimesh_collision:
  45. - void **create_trimesh_collision** **(** **)**
  46. This helper creates a :ref:`StaticBody<class_staticbody>` child :ref:`Node<class_node>` using the mesh geometry as collision. It's mainly used for testing.
  47. .. _class_MeshInstance_create_convex_collision:
  48. - void **create_convex_collision** **(** **)**