#1
|
|||
|
|||
animations - trim and blend
Hi,
I have a great animation I am using that was created using motion capture. Because of this I can only use the final CAF file. The thing is, I want to use only a portion of it. I am able to start the animation at different times using setAnimationTime and stopping it when I want using timers or vizact.waittime (is there a simpler way?). All this is fine except that there is no blending between my cycled animation and the one I use as above. Is there any way I can blend the beginning and the end of an animation when using setAnimationTime and stopAnimation to make them look smoother? Thanks, Ori |
#2
|
|||
|
|||
The best option is to export only the portion of the animation you want. If you can't do this then you can manually set the weight of the animation every frame by re-executing the animation. This means you would have to calculate the blending weight, but it is definitely possible. Here is a sample script that shows how to do this:
Code:
import viz viz.go() male = viz.add('vcc_male.cfg',pos=(0,0,5),euler=(180,0,0)) male.state(4) ANIMATION = 5 #Animate to blend BEGIN = 1.0 #Begin time of animation END = 4.0 #End time of animatoin BLEND = 0.5 #Blend time of animation def setAnimation(p): #Determine absolute animation time t = vizmat.Interpolate(BEGIN,END,p) #Manually calculate weight if t < BEGIN + BLEND: weight = vizmat.Interpolate(0.0,1.0,(t-BEGIN)/BLEND) elif t > END-BLEND: weight = vizmat.Interpolate(0.0,1.0,(END-t)/BLEND) else: weight = 1.0 #Stop previous animation male.stopAction(ANIMATION) #Re-execute animation at new weight male.execute(ANIMATION,weight=weight,delay_in=0,delay_out=0) #Pause the animatoin and set the time male.setAnimationTime(ANIMATION,t) male.setAnimationSpeed(ANIMATION,0) slider = viz.addSlider(pos=(0.5,0.1,0)) vizact.onslider(slider,setAnimation) |
#3
|
|||
|
|||
Thanks a lot! this code works great. I believe I can play with it and find a solution for my problem
Thanks again, Ori. |
|
|