MeshInstance

    Inherited By:

    Node that instances meshes into a scenario.

    MeshInstance is a node that takes a Mesh resource and adds it to the current 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 in many places. This allows to reuse geometry and save on resources. When a Mesh has to be instanced more than thousands of times at close proximity, consider using a in a MultiMeshInstance instead.

    Tutorials

    Methods

    voidcreate_convex_collision ( )
    void ( )
    voidcreate_trimesh_collision ( )
    get_active_material ( surface ) const
    Material ( int surface ) const
    get_surface_material_count ( ) const
    void ( int surface, material )

    The resource for the instance.


    Default
    Setterset_skeleton_path(value)
    Getterget_skeleton_path()

    • skin

    Sets the skin to be used by this instance.


    Defaulttrue
    Setterset_software_skinning_transform_normals(value)
    Getteris_software_skinning_transform_normals_enabled()

    If , normals are transformed when software skinning is used. Set to false when normals are not needed for better performance.

    See ProjectSettings.rendering/quality/skinning/software_skinning_fallback for details about how software skinning is enabled.

    Method Descriptions

    • void create_convex_collision ( )

    This helper creates a child node with a ConvexPolygonShape collision shape calculated from the mesh geometry. It’s mainly used for testing.


    • void create_debug_tangents ( )

    • void create_trimesh_collision ( )

    This helper creates a child node with a ConcavePolygonShape collision shape calculated from the mesh geometry. It’s mainly used for testing.


    • get_active_material ( int surface ) const

    Returns the that will be used by the Mesh when drawing. This can return the , the surface override Material defined in this MeshInstance, or the surface defined in the Mesh. For example, if is used, all surfaces will return the override material.


    • Material get_surface_material ( surface ) const

    Returns the Material for a surface of the resource.


    • int get_surface_material_count ( ) const

    Returns the number of surface materials.