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()
self.linesList.append(segs)
render.attachNewNode(segs.create())
if (len(self.linesList) > 20):
lineToRemove = self.linesList.pop(0)
lineToRemove.reset()
render.detachNode(lineToRemove)