#1
|
|||
|
|||
viz.vertex coordinates
Hello,
I want to create a vertex at the mouseclick position, but I don't know how to do it. If I create two vertex points: Code:
viz.startlayer(viz.POINTS) viz.pointsize(10) viz.vertexcolor(viz.RED) viz.vertex(0,0,10) viz.vertex(1,1,10) line = viz.endlayer() Code:
print viz.mouse.getPosition() The vertex are at [0,0,10] and [1,1,10] and my mouseposition shows [0.6,0.3] and [0.5,0.2]! Are the vertex coordinates world coordinates? Or what means 0,0,10? And what are the mouseposition coordinates? What's the reason for this difference. I want to create vertex at the mouseclick position. Can anybody help me - please. |
#2
|
|||
|
|||
If I create the vertex with this command:
Code:
point = viz.endlayer(viz.WORLD) But if I use Code:
point = viz.endlayer(viz.SCREEN) But I don't want to place the vertex at the screen. It should be placed in the world at the mouseposition and at 0 on the z-axis. I hope somebody understand my problem. I only want to create a vertex in the world (not at the screen), but exactly at the mouseposition. Is this possible? |
#3
|
|||
|
|||
Use the "screentoworld" method to get a direction vector. Then use vizmat.MoveAlongVector to find a place in space.
__________________
Paul Elliott WorldViz LLC |
#4
|
|||
|
|||
Hey Gladsomebeast,
I've got the same problem. I want to create points in the world, not on the screen. But I don't understand your answer. Could you write down the code, please? THANKS! |
#5
|
|||
|
|||
Looks like we don't need MoveAlongVector. Got this code from viztracker.py:
Code:
line = viz.screentoworld(viz.Mouse.getPosition()) line.length = desiredMetersFromView print line.end
__________________
Paul Elliott WorldViz LLC |
#6
|
|||
|
|||
Oh great, thanks a lot!!
|
#7
|
|||
|
|||
Helping make me happy.
__________________
Paul Elliott WorldViz LLC |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting object position in screen coordinates | v-Salik | Vizard | 1 | 10-19-2007 04:41 PM |
getPosition coordinates | AlyssaK | Vizard | 4 | 01-18-2007 05:19 PM |
Locating the Coordinates of Vertices for on the fly objects | shivanangel | Vizard | 4 | 10-30-2006 09:28 PM |
Translate HEAD_POS to absolute coordinates? | vrhelp2004 | Vizard | 1 | 05-18-2004 05:53 PM |