How do you set the path for an instantiated CSGPolygon from script?

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

Hello All,
I’m experimenting with making semi-random geometry CSGPolygons extruded along paths. I’ve made a path node that works fine with a test polygon that I’ve added to the scene tree. However, if I generate a new CSGPolygon from script and try and set to work with the same path nothing shows up.

If I set the mode to extrude or rotate, and it works fine (ie. I’ll get a little cube or a squat cylinder.)

I currently have the spatial node the script is on set as the child of the path node.

Here’s my code:

extends Spatial

var Leaves = preload ("res://Objects/Leaves for Trees/Leaves.material")


func _ready() -> void:
	FillItIn()


func FillItIn():

   var myMesh = CSGPolygon.new()

   myMesh.mode = 2

   myMesh.set_path_node("..")

   myMesh.set_material(Leaves)
   add_child(myMesh)

I’ve tried a bunch of variations on .set_path_node() and can’t seem to get it. Any assistance would be super!