#1
|
|||
|
|||
Translate bug?
When using the translate command if the final argument is RELATIVE_LOCAL
or ABSOLUTE_LOCAL the motion should be referenced to the object's local coordinate system, but the following code shows that to be true for RELATIVE_LOCAL but not ABSOLUTE_LOCAL. Press the '1' key to rotate the arrow in various directions and then the '2' or '3' key to translate in absolute or relative modes. The arrow supposed move in the direction it is pointing in both cases, but it doesn't for absolute. Is this a Viz bug or am I missing something? Sorry I forgot how to embed code properly. from viz import * go() obs = add('arrow.wrl') translate(HEAD_POS,0,0,-15) def onkeydown(key): if key == '3': obs.translate(0,-1,0,RELATIVE_LOCAL) if key == '2': obs.translate(0,-1,0,ABSOLUTE_LOCAL) if key == '1': obs.translate(0,0,0) obs.rotate(0,0,1,90,RELATIVE) viz.callback(viz.KEYDOWN_EVENT,onkeydown) |
#2
|
|||
|
|||
Hi Jerry,
ABSOLUTE_LOCAL means that you are setting the absolute position of the object, which in this case is (0,-1,0). This is regardless of the rotation of the node. In your example there would be no difference between ABSOLUTE_LOCAL or ABSOLUTE_WORLD. ABSOLUTE_WORLD comes into play when an object is underneath a hierarchy of other objects. In this case ABSOLUTE_WORLD means you want to place the object at the specified world coordinates, regardless of the parent transforms. RELATIVE_LOCAL is simply a pre-multiply operation on the existing transform. RELATIVE_WORLD is a post-multiply operation on the existing transform. |
#3
|
|||
|
|||
another ABSOLUTE_LOCAL question
HI,
I want to manually animate avatar's left hand. Here is my code: object = viz.add('Female.cfg') object.rotate(180,0,0) object.translate(0,0,7) lefthand = object.getbone('skel_HandL') lefthand.lock() print ' ' pa = lefthand.get(viz.POSITION, viz.ABSOLUTE_WORLD) print '(BEFORE) World Position of left hand is: ', pa[0], ', ', pa[1], ', ', pa[2] lefthand.translate(2,12,3,viz.xxxxxxxxxx) print ' ' pa = lefthand.get(viz.POSITION, viz.ABSOLUTE_WORLD) print '(AFTER) World Position of left hand is: ', pa[0], ', ', pa[1], ', ', pa[2] In the position of xxxxxxxxxx, I tried ABSOLUTE_WORLD, ABSOLUTE_LOCAL, RELATIVE_LOCAL, and RELATIVE_WORLD. But only ABSOLUTE_LOCAL changed the position of the left hand. And even with ABSOLUTE_LOCAL, the printed position before/after translate command were the same. Did I miss something? Thanks. |
#4
|
|||
|
|||
In case I didn't make it clear. My question, continuing the last poster, is why ABSOLUTE_WORLD or RELATIVE_WORLD didn't change anything? And why the displayed position before/after translate command always be the same, even I saw some change in the VR? Did I use <bone> command correctly?
Thanks. |
|
|