Hello,I’m trying to use LineSegs and can’t understand how to remove lines.
lines = LineSegs()
lines.moveTo(0,0,0)
lines.drawTo(0,2,0)
lines.setThickness(4)
Node = lines.create()
Np = NodePath(Node)
Np.reparentTo(render)
Then I’m trying to do this:
Np.removeNode()
lines.reset()
In fact, the API has no idea about deleting rows. If you want to delete rows, you need to present them as separate nodes.
from direct.showbase.ShowBase import ShowBase
from panda3d.core import LineSegs, NodePath
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
lines = LineSegs()
lines.moveTo(0,0,0)
lines.drawTo(0,2,0)
lines.setThickness(4)
lines1 = LineSegs()
lines1.moveTo(0,0,0)
lines1.drawTo(0,0,2)
lines1.setThickness(4)
Node = lines.create()
Node1 = lines1.create()
Np = NodePath(Node)
Np.reparentTo(render)
Np1 = NodePath(Node1)
Np1.reparentTo(render)
#Np1.removeNode()
app = MyApp()
app.run()
Falcon
3
Thanks, I tried and it seems, it does not work
Falcon
4
O,sorry it was mistake in code,now it works fine.