PDA

View Full Version : array select 1 value


Zword
01-20-2011, 08:15 AM
question


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
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 "<string>", 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



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]