WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Smooth transitions back to animations when unlocking bones (https://forum.worldviz.com/showthread.php?t=1935)

Enlil 03-26-2009 06:32 AM

Smooth transitions back to animations when unlocking bones
 
Hello,

I am locking the head bone to have an avatar look at an object, but I have run into an issue - when I unlock the bone, the head immediately jumps to an animation position, with no smooth transition. Is there some parameter or function I should be calling to get a smooth transition back into the animation when unlocking a locked bone?

Thanks,
Christian

Jeff 03-26-2009 01:12 PM

If you find out the head orientation at the start of the animation cycle, for example, then when you want the avatar to stop looking at an object, use vizact.headto to smoothly move the head to the starting position. Once its reached that position wait until the start of the next cycle and unlock it.

Enlil 04-01-2009 07:44 AM

Thanks.

Is there a good way to find the head orientation at the start of an animation cycle?

Christian

Gladsomebeast 04-01-2009 07:24 PM

To find out what orientation the animation has the head at unlock the bone, then call bone.getEuler(), then lock the bone again.

Also, I think it might be a bit more complicated than getting the bone orientation then calling vizact.headto(). This is because the head orientation will have changed by the time the headto action is done.

You could manually blend the head back. The vizmat.interpolate fuction will come in handy. It could go something like the following fake code:

Code:

while not isDone:
    currentEuler = bone.getEuler()
    bone.unlock()
    targetEuler = bone.getEuler()
    bone.lock()
    eulerBlendy = vizmat.interpolate(currentEuler, targetEuler, percentDone)
    bone.setEuler(eulerBlendy)



All times are GMT -7. The time now is 06:23 AM.

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