PDA

View Full Version : Getting Position


Lynnifer
04-18-2012, 11:34 AM
How can I find the absolute position in space of a 3d text object. I am using a 3d text "+" sign as a pointer in my program. It is attached to a parent node (handNode) which moves based on a motion tracker.

handNode = viz.add(viz.TEXT3D,'.')
#handNode.visible ( viz.ON )
handNode.color(1,0,0) # red
handNode.scale(.005, .005, .005)
pointer = handNode.add( viz.TEXT3D,'+')
#pointer.visible ( viz.ON )
pointer.translate(0, 0, 12)
pointer.color(1,0,0) # Red
pointer.scale(18, 18, 18)

Right now, I am using " pointer.get(viz.POSITION) " to get its position in 3d space. It can be seen in this statement of the program:

DaAngleBearing = self.findBearing( viz.get(viz.HEAD_POS), pointer.get(viz.POSITION) )
DaAnglePitch = self.findPitch(viz.get(viz.HEAD_POS), pointer.get(viz.POSITION) )


Right now, when I use print outputs to find what the program is doing, it looks like it's giving me the pointers position relative to another object, and that relative position is going into the statement above and being used to calculate the angle and pitch between head and pointer. I need to use the absolute position of the pointer. Any suggestions are appreciated.

DillonB
07-16-2012, 09:49 AM
pointer.getPosition(viz.ABS_GLOBAL) should give you the absolute position. Check out this tutorial: http://docs.worldviz.com/vizard/index.htm#Tutorial_list.htm