WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Getting position of a group of objects (https://forum.worldviz.com/showthread.php?t=4853)

mape2k 10-18-2013 01:19 AM

Getting position of a group of objects
 
Hello all,

I am trying to get the position of a group of objects (a tent composed out of small objects) in Vizard. I have read through the Hierarchical model tutorial and all is well, but it only explains how to get positions of single child objects. Here, a handle is grabbed to the object GEODE.
But for a group of object, I cannot create that handle because there is no geode. How can I export the model so that Vizard can grab a handle to the whole object and not just its lowest nodes? Below is an image of the coordinates I got in the Inspector. I need to get the position of the object 'tent' that is composed out of different smaller objects. Ironically, the inspector displays the right coordinates (marked with the red error)! Now I just need to be able to get them with the viz.getPosition() command. Any ideas?

http://i.imgur.com/xYBh3SD.png

mape2k 10-24-2013 11:51 PM

For each group of objects, I create a small sphere in the center of the group of objects. I grabbed the sphere handle in Vizard and could get their position.

However, this is very tedious with a lot of objects. Is there no other way?

farshizzo 10-31-2013 08:33 AM

You can use the node.getMatrix command to get the transform of a sub-node. In your specific example, you could retrieve the tent position displayed in Inspector using the following code:
Code:

pos =  model.getMatrix(viz.ABS_GLOBAL,node='tent').getPosition()


All times are GMT -7. The time now is 08:44 AM.

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