View Full Version : oscillate control?
blurgh 02-10-2007, 07:54 PM Hi guys,
Im trying to set up a fish character. I would like to set up an automatic oscillate control with a switch to manul animator control.
Is the oscilate usually done with a sine curve deformer?
How would the switch be handeled? much the same way as an IK/FK switch?
cheers guys
-Darken
|
|
isoparmB
02-11-2007, 07:06 AM
Pretty much like an IK FK switch, although there are a number of ways to do this. One of them is setting up our controllers below an object controlled by an expression which uses sine and cosine functions acting on the current frame value. You'd basically switch this gradually on and off by having an attribute which multiplies the result of the function: 1 for fully on and 0 for off. And since your controllers would be below these control objects, you should still be able to tweak the animation after the oscillate controls have done their part.
blurgh
02-13-2007, 11:04 AM
OK, GREAT!
does anybodyknow a script that could handle the sine and cosine functions? or willign to share an expression with me ? im not too handy with the ol' scripting ;)
Thanks for the imput IsoparmB!
BoostAbuse
02-13-2007, 02:45 PM
Hi guys,
Im trying to set up a fish character. I would like to set up an automatic oscillate control with a switch to manul animator control.
Is the oscilate usually done with a sine curve deformer?
How would the switch be handeled? much the same way as an IK/FK switch?
cheers guys
-Darken
Easiest way to do it is setup a spline IK chain for the main body of your character, I generally use a splineIK/FK setup with an extra dynamic curve. I'll use bend and sine deformers (usually 2 bend, 1 sine) on the fishes bodyCurve and then I'll pipe all of the attributes to be driven into an expression using velocity and acceleration. Just measure how far the fish travels along the curve, compare it to it's last frame and position, then calculate velocity and acceleration. Animators can tweak ontop of the procedural animation using the FK joints if they wish or they can also use the dynamic controls to adjust the bend and sine deformers as well as whatever other fields needed for the rig.
Hope that helps a bit.
-s
isoparmB
02-14-2007, 01:20 PM
This directly controls a nurbs sphere's translate X through an expression. You basically need a constantly changing value to input into the sine function, and either frame or time are perfect choices for this. I divided frame by 2 to slow down the reaction:
nurbsSphere1.translateX = sin(frame / 2);
If you wanted to be able to tone down the reaction or intensify it, though, you could set up a custom float attribute on the sphere which multiplies the result of the expression. Here I use a float attribute named oscillateStrength:
nurbsSphere1.translateX = (sin(frame / 2)) * nurbsSphere1.oscillateStrength;
Set to 0, the setup is virtually off. 1 is full normal strength, 2 is twice, so forth.
Now imagine you've set this up to work on a group node which happens to be the parent of your spine controls. You'd still be able to animate even with the oscillate controls on, and also be able to control the strength of the oscillate.
To get the right mix of how the fish curves, you could play around with with the sin and cos functions so that controllers would move in an alternating manner. You can also check the f1 help documentation regarding how to use sin and cos.
blurgh
02-15-2007, 08:07 PM
Hi guys,
I tried using the expression you posted IsparmB. Works a treat ! I was wondering is there a way to set up a control that agusts the number its divided by... so in essence makes the action slower?
cheers
-Darken
blurgh
02-23-2007, 09:43 PM
/bump /bump
any help would be appreciated!
isoparmB
02-24-2007, 05:47 AM
Sorry, just saw this now. For this you have to create a custom float attribute on your nurbsShere called .oscillateSpeed. The expression will now read the attribute and multiply frame by that value. You have to give it a decimal value if you want it to slow down, the lower the decimal value the slower:
nurbsSphere1.translateX = (sin(frame * nurbsSphere1.oscillateSpeed)) * nurbsSphere1.oscillateStrength;
blurgh
02-27-2007, 06:51 PM
Brilliant! thanks mate!!
-Darken
CGTalk Moderation
02-27-2007, 06:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.