Another freaking arm (and leg) rig with script

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Another freaking arm (and leg) rig with script

Post by heyvern »

It's been a while since I posted any rig, script or bone experiments here.

This is based on my "aim bone" script (included).

http://www.lowrestv.com/images/files/ai ... script.mov
http://www.lowrestv.com/images/files/aim_arm_bone.zip

The way the script works is you translate the hand/elbow control bone bone freely moving the arm in a sort of "3D" way. It scales the forearm/bicep creating a 3D type motion and foreshortening.

My original problem with the script was the lack of "elliptical" rotations of the forearm. I think I have that fixed now.

So you can still just translate the hand to create "linear" motion but if you rotate the extra bone at the elbow this ALSO translates the hand but in an elliptical motion.

Easier to just play with the file to see how it works. This is great for leg rigs as you can "lock" the feet without using lock bone at all for doing walk cycles. Feet stay put with out a lot of hassle.

The other problem with this rig is that you can't use the manipulate bones tool at all with it. Small sacrifice in my opinion for the benefits.

-vern
User avatar
Imago
Posts: 698
Joined: Wed Dec 10, 2008 9:48 am
Location: Sardinia

Post by Imago »

Great script!
It was exactly what I was looking for from ages!
Thanks!
Sorry for my bad english... Q_Q
Kazerad
Posts: 33
Joined: Sat Sep 09, 2006 8:48 pm

Post by Kazerad »

I've been looking for something like this for years; I can't believe it popped up right before I started a big animation project.

I'm still a total script newbie, though, and can't figure out how to apply it to my rigs :(. I see the bone setup you are using, and have successfully added more aimy-limbs to it, but can't figure out how to make a new file from scratch that uses the script.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

check the names of the bones and the parenting. There is an aim bone and a target bone. These two bones are a "set" or pair. The script is very straight forward.

You name the pairs...

bone.aim
bone.trg

or something like

hand.aim
hand.trg

The result is that the "aim" bone will always stretch to reach and point at the "trg" bone with the same name on the front of the name. They match up. The "aim" bone will not scale larger than 100% or "1" when the trg bone is translated.

-----------

Now the "tricky" part. Simple script. Simple set up, but what can you do with it? The tricky part is how you set up the bones with parenting to create an arm or leg that stays connected. The problem is you can't use a standard rig in a logical chain from bicep to forearm to hand in a chain.

The parenting has to be different.

Look at my sample file as it has only one "arm" set up and is as simple as it gets. Go to frame 0 and select the parenting bone tool (P). Study the parenting set up. It's a bit strange.

You have the "root parent" or shoulder bone. The top level bone. This bone rotates everything as eventually everything is a child of that top bone.
The bicep.aim (bicep) is a first child of the root bone.
the bicep.trg (elbow) is also a first child of the root bone.

Following down the chain, the arm.aim bone (forearm) is a child of the bicep.trg (elbow)
the arm.trg bone (wrist/hand) is a child of the arm.aim (forearm)

You have to sort of think about the bone relationship and how they are effected by the script. That is why you don't have to have bones in a chain in order for the limb to stay connected. You can't anyway because it would muck everything up.

Trying to explain it would just make it more confusing. the best bet is to look at the set up and try to replicate it or "practice" it so it makes sense.

The key is that since a bone will point at another bone it doesn't need to be "connected". The bicep.trg (elbow) doesn't have to be a child of the bicep.aim because that bone will always point to it. If you made that bone a child of the aim bone it would muck it up because you would have conflicting rotations.... it's a bit of math I haven't figured out yet.

This is a very simple script. With a bit of effort I probably could do a better job of creating logical chains. However that takes a lot of math... figuring out cascading bone rotations and vectors pointing to point locations based on animated positions etc etc, blah blah blah.

I hate math. ;)

-vern
Kazerad
Posts: 33
Joined: Sat Sep 09, 2006 8:48 pm

Post by Kazerad »

I think I found my problem. I have the bones named right and the script in the folder with them, but am not sure how to apply the script. When I open your file in Notepad I notice there's a line that directly refers to aim_bone.lua, (layer_script "aim_bone.lua"), but I can't figure out how to set the layer script in Anime Studio itself. This seems like something really obvious, but I couldn't find it in the help file :?.

EDIT: aha, nevermind. Google turned up the result I needed. That "embedded script file" checkbox is terribly well hidden though, and a little misleading (how often to checkboxes bring up a file select window?)

EDITEDIT: I did notice a rather strange glitch that could cause bones to spin by simply moving the magnet tool around (eve not clicking anything). I found a workaround by changing the parenting, but just thought you should know this happened.
Post Reply