Getting an object location
I'm feeling a little frustrated right now. I am trying to get the 3D position of an object within an exported OSGB scene. I know the name of my object; I've called it target. I can even find this object using the following snippet of code:
Code:
for nodeName in WholeEnviroment.getNodeNames(): Code:
print node.getPosition() Code:
print node.getPosition(viz.ABS_GLOBAL) Neither are correct. The correct position of this object is [-11.54891, 2.32127, -16.42012]. I am able to use viz.pick to select the object and I get the correct position which is great. However, viz.pick() seems to return the lowest level of an object (the material name in this instance). Why am I unable to get a sensible value from simply specifying the node name? I'm either missing something very obvious or it's just another annoying quirk of Vizard. This is how the structure of this node looks like in Vizard inspector: http://prntscr.com/dg30pa |
Are there multiple sub-parts with the same name? Are you able to attach the model here or upload for us to look at? Using the viz.ABS_GLOBAL flag should work.
|
Hi Jeff,
Thanks for the speedy reply. I've uploaded the model using the link provided (1677024). The target object is called "target". |
Try using either the node.getTransform command or the node.getChild command with the viz.CHILD_REPLACE_TRANSFORM flag:
Code:
import viz |
Hey
i got a pretty similar problem, so i just add this here and hope you can help me i want to locate both arms from my avatar, to get the distance from the Grabbing point (grabber is attached to avatars arms) to the object i want to grab. Code:
ground = viz.addChild('ground_gray.osgb') basicly what i want to do is to get the locations of both the box, pyramid, and torus shapes and from the grabber tool from my vizconnect program and give them out |
All times are GMT -7. The time now is 03:57 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC