How do I destroy a LineSegs?

Hi, I am using a LineSegs object to draw the path an AI agent is following.
I want to erase the path after a few seconds, how can I do it?

Here is the code that draws the path:

	def drawWay(self):
		segs = LineSegs()
		segs.setThickness( 1.0 )
		segs.setColor( Vec4(1,1,0,1) )
		segs.moveTo( self.lastPos )
		segs.drawTo( self.agent.getPos())
		self.lastPos = self.agent.getPos()
		if (len(self.linesList) > 20):
			lineToRemove = self.linesList.pop(0)

Save the result of attachNewNode, it’s the NodePath you just created, then call nodePath.removeNode() when you want to remove it.

myLines = render.attachNewNode(segs.create())


Ah, of course, I totally forgot attachNewNode returned a node.
Thanks a lot, I feel stupid now . :blush: