PDA

View Full Version : <node3d>.getPosition() returns [0,0,0] all the time...


DrunkenBrit
02-06-2009, 09:53 AM
Hi,

I create a simple scene in 3DSM, export as either WRL or IVE format. All the scene contains is a plane, a few boxes and a sphere.

All 3 shape objects are positioned away from the origin. When i try and get access to one of the shapes:


scene = viz.add(scene.ive')
scene.disable(viz.LIGHTING,'')

sphere = scene.getChild('Sphere01')

print "sphere pos: ", sphere.getPosition(viz.ABS_GLOBAL)



I've tried printing the positions of all other objects too and also tried using viz.REL_PARENT, viz.ABS_PARENT etc which also return [0,0,0]

Any reason why this is happening please?

Thanks,
DB

Jeff
02-06-2009, 11:20 AM
If you right click on your scene node in the Vizard resources window and select properties, then expand the VIZARD_NODE you'll see your Sphere01 child. Expand that and you will see 'Sphere01-GEODE', which is what you want to use.
sphere = scene.getChild('Sphere01-GEODE')
print "sphere pos: ", sphere.getPosition(viz.ABS_GLOBAL)

DrunkenBrit
02-09-2009, 12:53 AM
Thanks for your reply; that worked fine! Could you explain why extra characters are added to the end of the node name? Why does it work like this to get access to a child node:


dummy = scene.getChild('dummy')


Yet to print the position i need to add on '-GEODE'?

Thanks.