PDA

View Full Version : A point in avatar's coordinate system


omidbrb
05-14-2009, 05:23 AM
Hi,

This is probably a very simple question but I couldn't find a simple function to calculate that in vizard. How can I find the position of a point that we have it in global coordinate system with respect to some object's coordinate system (specifically an Avatar's local coordinate system) ?

Thanks a lot,
Omid

Gladsomebeast
05-14-2009, 11:34 AM
#easy way
target = viz.addGroup(pos=[1,0,1])
root = viz.addGroup(pos=[6,1,3])
helper = viz.addGroup(parent=root)
helper.setPosition(target.getPosition(), viz.ABS_GLOBAL)
print helper.getPosition() #mode defaults to viz.ABS_PARENT

#mathy way
#T=OR so T(1/R)=0
T = target.getMatrix()
R = root.getMatrix()
O = T * R.inverse()
print O.getTrans()

omidbrb
05-15-2009, 05:39 AM
Thanks a lot. I'll try the solutions.

I'm wondering why it wasn't written in the documentation that the viz.addGroup function accepts the "pos" parameter.