-----------------------------------------------------------------------------

 Jiggles (physics of acceleration)
 3/3/04
 Copyright (c) 2004 David G. Drumright (ockham)

-----------------------------------------------------------------------------

New 2009:

Because later Poser versions (and Windows Vista) have many variations in
file-writing techniques and access limits, I've added a "Jiggles-NoDat"
version that doesn't write or read a data file.  When using this
version, you'll have to hit the Analyze button every time the script
starts.

And a second new variation in response to a request.
Jiggles2009 includes a "Floor" slider along with the Twang, CPS, and so on.
This gives you the chance to eliminate smaller "noisy" wiggles.  A setting
of about 0.1 seems to be good



-----------------------------------------------------------------------------

1.	Set up your animation first, as usual.	Determine which morphs need to
	move in the three major directions.  Most morphs are primarily up-down or
	side-side, but you may have one that is sort of diagonal.  In that case
	you will need to apply it in two directions.  Try to determine what value
	corresponds to the likely maximum movement in your animation.

	[NOTE 1] If your figure doesn't have the morphs you want, you can
	create them easily enough using Poser's magnets or waves.  For this
	purpose, the morph target doesn't need to be as pretty or precise as
	a "professional" job!

	[NOTE 2] Jiggles can operate on any parameter, not just a MT. For
	instance, you might use the Z Rotate parm to make a tall object
	wobble when pushed rightward.  This will generally take more thought
	and preparation than using morphs; for instance, the object's Origin
	should be at the desired center of rotation.  Scale parameters can
	also be used, to make an object compress in various directions when
	it speeds up or slows down.

2.	Select the body part or prop that holds the relevant MTs (such as
	Hip, Chest, Left Collar) before activating Jiggles.

3.	Activate Jiggles.

4.	The first stage of Jiggles is to analyze the motion, which takes a
	considerable amount of time.  Jiggles tries to save you some labor by
	preserving the result of each analysis, so you can restart the script
	several times during a session without having to redo the analysis.

	If the Analyze button shows green, this means you must hit it now to
	run the analysis.  The other buttons are disabled at this point, so
	you have no choice.  If it shows red, you don't necessarily need to
	run it.  But if you've changed something important, like the nature
	of the motion or the length of the animation, then you should do the
	Analyze stage even if the button is red.

	[In the new Jiggles-NoDat version, you always have to hit the Analyze button.]

5.	Now, whether you had to run the analysis or not, highlight one or more
	morphs in the list, that will share the same direction and calibration.

6.	Fill in the Multiplier number.	If you leave it blank, Jiggles will use 1
	for the Multiplier, which may work fairly well for a "typical" morph.
	But there's no standard here.  Morph targets vary tremendously in their
	calibration, so you will generally need some trial and adjustment.

7.	Finally, hit the direction that this MT needs to move:	Down, Left,
	or Front.  I use these names instead of "Up-down", "Left-Right",
	and "Front-back", to make the default directions easier to remember.

	Downward is the positive direction for the Y component.
	So if you have a MT named "Breast Droop", which pushes the breasts
	down when its value increases, it should work as is.  If you have a
	MT named "Breasts Up", you'll probably need to make the Multiplier
	negative.

	Leftward is the positive direction for X motions.
	So if you have a MT named "Left Hair Out", it should work as is.

	Frontward is the positive direction for Z motions.
	So if you have a MT named "Bangs Forward", it should work as is.

	As mentioned above, if you have a diagonal movement, you'll need to
	select it in two different directions, with appropriate values on
	the multiplier.

	[NOTE] On Side-Side, Jiggles does a special trick to make things
	easier.  If you have highlighted exactly two morphs, and their names
	begin with L and R, the script will assume that the L item moves as
	described above, and the R item moves oppositely.  If the morphs are
	typical, this will usually be correct; but if the result is
	backwards, you can then enter a negative Multiplier to invert the
	pair together.	If you want to take advantage of this trick with a
	pair that doesn't begin with L and R (say OutLeft and OutRight)
	you'll have to temporarily rename them to put the L and R in the
	first letter.

8.	[OPTIONAL] The Gravity slider applies only to Up-Down motions.	It simply
	adds a downward bias.  The value has no connection to units or mass;
	you'll just have to try small values first and see how it looks.

9.	[OPTIONAL] The Twang controls will give you a certain amount of
	damped oscillation along with the main acceleration.  The slider
	labeled "Twang" controls the strength of the twang and turns it on
	or off.  The default setting is 0, which adds no twang.  The "Secs"
	slider determines how long the Twang continues before it dies off to
	an imperceptible amount.  This is longer than the noticeable period,
	so you should probably set the Seconds to twice what you imagine is
	right.	The "CPS" slider determines the frequency of the twang in
	Cycles Per Second.	For body parts, 3 CPS is probably about right.
	If you're working on a large tank of water or something like that,
	the frequency should be lower.

10. [Only in the new Jiggles 2009]: The Floor control sets a baseline
	below which the movements will be cut off.	This is proportional,
	and a setting of 0.1 appears to be good.

11. After you hit a direction button, the appropriate acceleration will be
	applied to that morph dial, just about instantly.

12. Look at the resulting animation.  If the movement is too large or small,
	or goes the wrong way, restart the script and don't bother to hit Analyze
	again.	Try a different or opposite Multiplier value, then hit the same
	direction button again.

	For instance, if the movement should be twice as large as the first
	try, enter 1.5 in Multiplier.  If the motion is about the right size
	but backwards, enter -1.0 in Multiplier.

-----------------------------------------------------------------------------
