Genete! Springy bones 3D rotation with one bone.
Posted: Thu May 24, 2007 8:04 am
Here will be the link to the latest version of the script:
http://www.lowrestv.com/moho_stuff/3Dgrid5.lua
You should also download the latest AS file that Genete is working on later in this thread.
________________________________________
Instructions
The bones are named as "sets" with the same bone name in front of a two letter extension where indicated:
Bones marked with * must exist in the file for the script to work.
(These 2 bones are not part of a set. They control all the sets of bones. No extension required.)
MasterY -- master Y rotation (alpha) *
This is the bone that controls the Y rotation
MasterX -- master X rotation (beta) *
This is the bone that controls the X rotation
Create multiple sets of bones by using a different name for each set.
(Rx and Ry are optional for each "set" but you must have at least one or the other. When either is missing the rotation "offset" defaults to 0 for that axis.)
bonename.Rx
This bone's length determines the distance of the "point" bone from the center of the front view. For example, the sides of a nose or the corners of a mouth.
boneame.Ry
This bone's length and rotation determine the "point" bone's location in 3D space from the side view. For example, the distance from the "center" of rotation to the tip of the nose or the chin.
bonename.pt *
This bone represents a 3D point in space.
________________________________________
And here children is how this story began...
Once upon a time...
(the picture gets all wiggly and fades to Vern typing on the keyboard. He has been drinking a lot of coffee and it is either very late at night... or very early in the morning... depending on your point of view.)
~~~~~~~~~~~~~~~~
Genete,
I came up with a cool idea with some simple scripting. I need to pull the concept out of another script but here's the basic idea.
Remember when you were doing those full head and full body rotations with your springy bones? You needed a lot of individual springs at different locations and sizes to create the 3D rotation for each point in the 3D space.
One of the reasons I leaned away from this was the complexity of positioning all of the bones and the number of bones needed.
What I've done with scripting using that math lesson you gave me, is the possibility of creating multiple points of 3D space based on just a few bones.
Based on this:
X=X0+L*sin(alpha)
With L being a variable that could be changed dynamically for each point in the 3D space. There could be as many or as few spots as needed based on the number of bones. Completely flexible.
By creating a table in the script of a whole set of points each bone could be named to move in that spot. All of it driven by ONE BONE'S ROTATION. You wouldn't need all of those spring bones. This would be calculated in the script automatically. X and Y translation would be handled separately for each bone.
It could be based on the number of bones and some kind of user setting on a bone to determine the distance from a central point.
The trouble I have is figuring out the math to create the 3D "grid".
If this could be done with a script... it would be simple to set up a 3D space and bind points to bones, or whatever, even region binding would work. Add in the layer flipping and it's even cooler.
Let me know what you think.
So far my test script works FANTASTIC! I linked the L variable in the formula to the scale of a bone so I can change it on the fly. I did this for testing purposes. In actual use this should work very smoothly. At least as well as doing it with constraints.
Maybe this could be the way to customize the 3D... by just changing the scale or length of a small set of bones to define the points in space.
This might be the full side to side turn solution we've all been looking for.
-vern
http://www.lowrestv.com/moho_stuff/3Dgrid5.lua
You should also download the latest AS file that Genete is working on later in this thread.
________________________________________
Instructions
The bones are named as "sets" with the same bone name in front of a two letter extension where indicated:
Bones marked with * must exist in the file for the script to work.
(These 2 bones are not part of a set. They control all the sets of bones. No extension required.)
MasterY -- master Y rotation (alpha) *
This is the bone that controls the Y rotation
MasterX -- master X rotation (beta) *
This is the bone that controls the X rotation
Create multiple sets of bones by using a different name for each set.
(Rx and Ry are optional for each "set" but you must have at least one or the other. When either is missing the rotation "offset" defaults to 0 for that axis.)
bonename.Rx
This bone's length determines the distance of the "point" bone from the center of the front view. For example, the sides of a nose or the corners of a mouth.
boneame.Ry
This bone's length and rotation determine the "point" bone's location in 3D space from the side view. For example, the distance from the "center" of rotation to the tip of the nose or the chin.
bonename.pt *
This bone represents a 3D point in space.
________________________________________
And here children is how this story began...
Once upon a time...
(the picture gets all wiggly and fades to Vern typing on the keyboard. He has been drinking a lot of coffee and it is either very late at night... or very early in the morning... depending on your point of view.)
~~~~~~~~~~~~~~~~
Genete,
I came up with a cool idea with some simple scripting. I need to pull the concept out of another script but here's the basic idea.
Remember when you were doing those full head and full body rotations with your springy bones? You needed a lot of individual springs at different locations and sizes to create the 3D rotation for each point in the 3D space.
One of the reasons I leaned away from this was the complexity of positioning all of the bones and the number of bones needed.
What I've done with scripting using that math lesson you gave me, is the possibility of creating multiple points of 3D space based on just a few bones.
Based on this:
X=X0+L*sin(alpha)
With L being a variable that could be changed dynamically for each point in the 3D space. There could be as many or as few spots as needed based on the number of bones. Completely flexible.
By creating a table in the script of a whole set of points each bone could be named to move in that spot. All of it driven by ONE BONE'S ROTATION. You wouldn't need all of those spring bones. This would be calculated in the script automatically. X and Y translation would be handled separately for each bone.
It could be based on the number of bones and some kind of user setting on a bone to determine the distance from a central point.
The trouble I have is figuring out the math to create the 3D "grid".
If this could be done with a script... it would be simple to set up a 3D space and bind points to bones, or whatever, even region binding would work. Add in the layer flipping and it's even cooler.
Let me know what you think.
So far my test script works FANTASTIC! I linked the L variable in the formula to the scale of a bone so I can change it on the fly. I did this for testing purposes. In actual use this should work very smoothly. At least as well as doing it with constraints.
Maybe this could be the way to customize the 3D... by just changing the scale or length of a small set of bones to define the points in space.
This might be the full side to side turn solution we've all been looking for.
-vern