a script to render a mesh as wireframe

gorrgolemgorrgolem Posts: 1Member
edited May 5 in Resources

script to add to a meshinstance you want to render as wireframe :

extends MeshInstance



func _ready():

    var a = mesh.surface_get_arrays(0)
    var m = mesh.surface_get_material(0)
    mesh.surface_remove(0)
    mesh.add_surface_from_arrays(1, a)

    #if there's more than one surface, the surface idx should be the last
    mesh.surface_set_material(0, m)

Tags :

Comments

  • MegalomaniakMegalomaniak Posts: 1,585Admin

    Moved to resources since it fits better in here, you might want to attach some license to the code snippet. MIT perhaps? :)

Sign In or Register to comment.