PDA

View Full Version : I have a question about link data


atamasan
09-16-2009, 06:54 PM
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....

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:link.update()
print sensor.getEuler(), bone.getEuler()

3) Retrieve the euler values directly from the link: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.