WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-25-2010, 09:03 AM
migoloco migoloco is offline
Member
 
Join Date: Sep 2010
Posts: 5
Question [0.0, 0.0, 0.0] for every object.getPosition()

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.
Reply With Quote
  #2  
Old 09-27-2010, 11:20 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Please use the [code][/code] 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:
Code:
if object.valid():
    print object.getPosition()
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:50 AM.


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