WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   I have a question about link data (https://forum.worldviz.com/showthread.php?t=2269)

atamasan 09-16-2009 06:54 PM

I have a question about link data
 
Hi.
Now I finally solve my problem(I posted before).
But only one thing make me confused.
When I use link, source data is different from destination data.

Uh, for example....

Code:

sensor=viz.addSensor('patriot')
hand=viz.add('hand.cfg')
bone=hand.getBone('bone index 1-2')
bone.lock()
link=viz.link(sensor,bone)

def print(e):
    print sensor.getEuler(), bone.getEuler()
viz.callback(viz.UPDATE_EVENT,print)

bone is linked, so I think "sensor.getEuler() and bone.getEuler() are same data, but it's different.

Do you have any idea for this?

Thank you very much.

farshizzo 09-17-2009 05:47 PM

Link objects do not get updated until later on in the update cycle. There are a few ways to deal with this.

1) Register your callback with a priority greater than viz.PRIORITY_LINKS

2) Manually update the link before retrieving the values from the bone:
Code:

link.update()
print sensor.getEuler(), bone.getEuler()

3) Retrieve the euler values directly from the link:
Code:

print link.getEuler()

atamasan 09-17-2009 06:47 PM

Hi, farshizzo.
Thank you for your advice.
I didn't know "viz.PRIORITY_LINKS".
I'll try the manually update method you taught me.

Thank you again.


All times are GMT -7. The time now is 01:37 AM.

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