Hi, Is there a way to draw a line between two 3d points? I would also possibly like to vary the thickness of the lines
Thanks
-Salik
Hi, Is there a way to draw a line between two 3d points? I would also possibly like to vary the thickness of the lines
Thanks
-Salik
Yup, here you go.
lines = LineSegs()
lines.moveTo(x1,y1,z1)
lines.drawTo(x2,y2,z2)
lines.setThickness(4)
node = lines.create()
np = NodePath(node)
np.reparentTo(render)
Ahhh… thanks that works.
Is there a way to change the line color? I could not find anything about what you mentioned in the docs.
Yes, there are ways.
The manual is not the only piece of documentation. It’s just for getting you started, and to explain a few concepts. Much more important if the API reference. Look at the documentation of the class LineSegs, and look there for methods which have “color” or “thickness” in their name:
http://panda3d.org/apiref.php?page=classes
enn0x
You can also just do a setColor on the node.
I draw lots of lines in my game and they are slow. I am wondering if it would be faster to create a geom with say 1000 vertexes and just use vertex rewriter and if have extra just draw 0 length lines?
But that is more advanced feature not recommended for newbies.
I tried this code but it seems that the line thickness only goes so far. I need to get it thicker. Any suggestions?
No its a hardware limit. If you want lines generated with real geometry (rectangles that look like lines) you might have to wait till 1.6.0 and then use MeshDrawer
thanks