#1
|
|||
|
|||
Draw Line between Points
Hi,
I want to create a line between two points. The first point at the mouseDown Position and the second point at the mouseUp Position. Between these two points I want to draw a line. This works very fine. But now I want to show the line, before the mouseUp Event. So that I push down the mousebutton, move it at another position and can already see the line, although the mousebutton is pushed. The line would change as long as I push the mousebutton. Is this possible? Thanks in advance... |
#2
|
|||
|
|||
Yes, this is definitely possible. Here is a sample script that uses the viztask module to draw lines with the mouse:
Code:
import viz import viztask viz.go() def DrawLineTask(): while True: #Wait for left mouse butten to be pressed yield viztask.waitMouseDown(viz.MOUSEBUTTON_LEFT) #Get mouse position pos = viz.mouse.getPosition() #Create line viz.startlayer(viz.LINES) viz.vertexcolor(viz.RED) viz.vertex(pos[0],pos[1],0) viz.vertex(pos[0],pos[1],0) line = viz.endlayer(parent=viz.SCREEN) #Create link between mouse position and vertex VertexLink = viz.link(viz.Mouse,line.Vertex(1)) #Wait for mouse button to be released yield viztask.waitMouseUp(viz.MOUSEBUTTON_LEFT) #Destroy link VertexLink.remove() viztask.schedule( DrawLineTask() ) |
#3
|
|||
|
|||
Hi,
thanks a lot! And how can I stop the schedule, so I'm able to draw only two lines and no more?? Is there a possibility to save the separate positions of all these four vertex? |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pivot points for child objects in Vizard with 3ds Max | Gladsomebeast | Vizard | 0 | 09-19-2006 12:21 PM |
problem with collision detection | paulpars | Vizard | 6 | 06-09-2006 07:03 PM |
Draw Line between Points selected by mouse | Johannes | Vizard | 7 | 01-07-2005 03:50 PM |