View Full Version : Scripted stretchy Ik-arm (and leg if all works out) Need help
01-09-2005, 11:35 PM
I started scripting a stretchy arm today. Was fed up with remaking arms for different rigs so I decided to automate it with maxscript. Got my max file and wrote down what's paranted to what etc and now I'm reverse engineering the whole thing. So far I've made all the meshes, helpers by script , wired up fingers and added dumies to them so you can rotate them independently of the wiring.
Now a couple of things got me blocked. I added in constraints (look at & position) to the objects that need them. Now here's the tough part - how can I tell maxscript what object the orientation constant is looking at? (same thing for the position). I can't find any target commands in the help file and listener is totally top-secret about it. One last thing got me worried. I can't seem to give bones names.
I've got like
BoneSys.createBone [0,0,0] [60,0,0] [0,0,1]
I can't seem to add name:"blabla" anywhere in the syntax and I need to rename them during creation (they're lookat targets so they need names :/) Besides I can't risk refering to them as bone01 or 02. If someone had a bone made previously the names would pretty much get screwd.
Please maxscript gods help me out :) and you'll all get some nice stretchy hands at the push of a button
01-10-2005, 12:30 AM
you can name the bone like this
blah = BoneSys.createBone [0,0,0] [60,0,0] [0,0,1]
blah.name = "this is blah";
to add targets to position constraints and orientataion constraints you need something like
poscon=obj.position.controller = Position_Constraint ();
poscon.constraints.appendtarget (target here) (weight here);
look it up in the maxscipt reference
01-10-2005, 07:48 AM
Thank heaps Mark. IT WORKEd!! :) Now I can get this going again. I'm thinking of adding a forearm twist once it starts working
01-10-2005, 10:32 AM
Ok so I got another thing bugging me. Got the arm to move, rotate nicely. The arm is controlled by surrounding editable poly boxes. The boxes are supposed to stretch with the stretching of the bones.
So i added a linked X form modifier to the las face of the editable poly box. I linked it up to a dummy a the end of arm segment and BAM!~ %^$%^$.
The face goes to a different spot instead of staying nicly put. I think it's got something to do with the fact that I changes the boxes pivot point position by using the $.pivot = [60,0,0] command. Is there a way of stopping this??
I guess I could patch things up by moving the face back to it's oryginal spot after the linked xform but I'm not sure how to move faces at a sub object level :shrug:
01-10-2005, 10:36 AM
ok found affect region....guess this will help once I mangle it a bit
01-10-2005, 12:14 PM
if you want help you'll midght want to post the script or portions of so people can see exactly what you doing
01-10-2005, 12:44 PM
Yeah I have to setup a site where it can be downloaded from. Besides if it sits on my hd than I'm a little more restrained when it comes to asking stupid questions :) I'll try and make a site this evening
01-10-2005, 02:50 PM
My 5 minute webpage (http://members.lycos.co.uk/krajczyk/index.html)
So this is where you can snag my script for analasis
Happy bug huntin to all :thumbsup:
PM Me If you want more features
01-10-2005, 04:39 PM
Ok i ironed out some problems with the scirpts ...now back to the drawing board
01-11-2005, 11:32 PM
had a quick look at your script, first off i would make most commonly things into functions so you dont have to type the same stuff repeatedly and run them through loops,
also you might want to make the creation of the arm with relation to point helpers so you can reposition them to make different arms - also make the arm creation a fucntion also so it can be called for either right or left arm (you don't need twice the code for two --or any number-- arms
don't know why you are using xforms on you boxes?
i am currently writting a script to make a full rig (its big - its like 50 pages) so cutting down on its size will make a big difference (less to sift through when editing) later on if changes need to be made.
need me to elaborate just ask
01-12-2005, 01:03 AM
This is actually my second script maxscript so I'm still a noob when it comes to coding. I'll be refining it along the way.
I wanted to use linked xform on the boxes to have mesh around then and give me a biped feel to them. I could get rid of them and base it of entirely on bones (guess it'd be easier to toggle them in the viewport later on). I was thinking of adding a left/right arm option, just reversing the x coordinates.
I guess the arm could be created anywhere and aligned in the end to a picked object/point
I'll have to look into loops & arrays for this to evolve heh ?:D
Good luck on your rig Marktsang
01-12-2005, 01:21 AM
Ok time for a bold decision. I'm scraping most of the script & jumping into deep water.
I decided to
* add a spinner the the amount of fingers. I'm gonna base it on a loop creating 1 finger and then distributing it along the palm equally.
* Change the hand script so it'll have the right amount of sliders & spinners for each finger.
* I'm ditching the mesh and sticking to bones and helpers.
Hopefully the new script will be cleaner & more logical
Now I'm of to bed :)
01-12-2005, 01:38 AM
as i said earlier you are proabaly better off using point helpers to dictate the amount of joints (fingers ect) rather than using a spinner as you cannot set individual orienation or position with a spinner. your better off to make it as flexible as possible so you don't need to write a new one down the road. with point helpers to guide the rig you can set it to any size or shape, and every thing is nicely zeroed out (if you set it up that way) fromt he start so you dont have to fiddle with it after running the script you only have to skin (hopefully) at least thats the way my script is! i also have many many options in mine like optional n number wrist and shoulder twist bones with mannual or automatic controls - optional strechy limbs - ik , fk or both with two different systems and blending systems- ect. ect...
i am also new a maxscript and the rigging script is my third script, i have been learning for only about 2 months so i by no means know it all - these are just some things i have learned from what little i have done.
01-20-2006, 10:00 AM
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-2013, Jelsoft Enterprises Ltd.