#1
|
|||
|
|||
get vertex with on the fly object
Hello, I was wondering if it's possible to get the value of a vertex of an on-the-fly object? I create a line, then scale it, then I need the value of the scaled vertex.
|
#2
|
|||
|
|||
Please help, all I need is a get method for the vertex position. I'm pretty sure the values exist somewhere. Something like:
[ x, y, z ] = myOnTheFlyLine.getVertex( 0 ) # to get the x,y,z of the 0th vertex [ x, y, z ] = myOnTheFlyLine.getVertex( 1 ) # to get the x,y,z of the 1th vertex |
#3
|
|||
|
|||
Sadly, Vizard provides no way to get the vertex positions The workaround is to recorde the positions of the vertexes when you add/modify them.
|
#4
|
|||
|
|||
Sadly that workaround would not work for me, as after I set a vertex I scale the object. To get that new point, I would need to do quite a bit of math which I would like to avoid...
|
#5
|
|||
|
|||
Hmm. OK, heres a possible solution: add a child object to the on-the-fly object before you scale it. Translate the child object to the position of the vertex you are interested in. Then scale the on-the-fly object. Then print out the child objects position.
Code:
l = viz.add( 'logo.wrl' ) b = l.add( 'ball.wrl' ) b.translate( 1, 0, 0 ) def onkeydown(key): l.scale( 3, 3, 3 ) print b.get( viz.POSITION ) viz.callback(viz.KEYDOWN_EVENT,onkeydown) |
#6
|
|||
|
|||
Interesting, I shall try it and let you know if it works out.
|
#7
|
|||
|
|||
Hey. I tried it, however the position of the ball, while it appears in the world where it is translated/scaled to, the position values remain the same. :-(
|
#8
|
|||
|
|||
Boy that Vizard is a whily one. Maby I'll have something for ya tomorrow. Something with the new viz.link() functianlity or something.
__________________
Paul Elliott WorldViz LLC |
#9
|
|||
|
|||
I got it!
b.get( viz.POSITION ) gets the position locally, while b.get( viz.POSITION, viz.ABSOLUTE_WORLD ) gets what I want :-) Thanks for the help! |
#10
|
|||
|
|||
Instead of adding a model, such as 'ball.wrl', add a Group to increase performace and avoid having to remove the ball.
Code:
vertexTracker = logo.add( viz.GROUP )
__________________
Paul Elliott WorldViz LLC |
Thread Tools | |
Display Modes | Rate This Thread |
|
|