WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   array select 1 value (https://forum.worldviz.com/showthread.php?t=3355)

Zword 01-20-2011 08:15 AM

array select 1 value
 
question

Code:

for cod in wall_1.getPosition()
        print cod

This will print the x y z coordinates. Now all i want is the z coordinate value. How?

Darkmax 01-20-2011 08:33 AM

Code:

for cod in wall_1.getPosition()
        print cod[2]


Zword 01-20-2011 08:41 AM

tried that doesn't work


Traceback (most recent call last):
File "", line 11, in ?
File "Test wall.py", line 106
for cod in wall_1.getPosition()
^
SyntaxError: invalid syntax

Zword 01-20-2011 09:38 AM

The point is that my z coordinate is constantly reset to 0.5 but what i want is that it get the object.getPosition += 0.5


Code:

def moveWallBackward ():
    global pos
    object = viz.pick()
    if object.valid():
        pos -= 0.5
        object.setPosition([0,-4,pos])
vizact.onkeydown( 'j', moveWallBackward )


vOliver 01-24-2011 12:41 PM

cod = wall_1.getPosition()
print cod[2]


All times are GMT -7. The time now is 07:03 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC