How to go about creating an outline mesh and adding it to a scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rye

I am new to Godot and it’s wonders. Currently I am trying to make the create_outline() function to work but I have hard time finding a way to make the mesh created that way visible in a scene. Am I doing something horribly wrong here or why is it that nothing shows on the scene run time beside the original plane the script is attached to? The documentation in this regard is rather vague.

  extends MeshInstance

    func _ready():
    	var mesh_outline = mesh.create_outline(2)
    
    	var NewMesh = MeshInstance.new()
    	add_child(NewMesh)
    	NewMesh.set_mesh(mesh_outline)

Never did this but the docs reads like the normals on the outline are flipped. (Just guessing) So if backside culling is on for the material then the mesh can only be seen from “inside”. Try it out, increase the margin a bit and move the camera inside the outline mesh.

wombatstampede | 2019-05-03 14:29