PDA

View Full Version : [0.0, 0.0, 0.0] for every object.getPosition()


migoloco
09-25-2010, 09:03 AM
I am trying to use viz.pick() to get the position for an object that a click on, but all I get is [0.0, 0.0, 0.0]. What am I doing wrong? Here is a simple example code:

import viz
viz.go()
import vizcam
viz.cam.setHandler(vizcam.KeyboardCamera())

viz.add('gallery.ive')

def showPicked():
object = viz.pick(0)
if object.valid:
print object.getPosition()

vizact.onmousedown(viz.MOUSEBUTTON_LEFT, showPicked)

Thank you very much.

farshizzo
09-27-2010, 11:20 AM
Please use the tags when posting sample code on the forum. This will preserve indentation which is necessary for running Python code.

In your code, you are incorrectly using the valid attribute of the node object. It is a function, so you need to call it:if object.valid():
print object.getPosition()