View Full Version : Controls to Links objects (props)
01-13-2009, 11:34 PM
This could verywell be my first post here (eventhough I've been lurking around for some time), and it pains me to say I come asking for your advice.
I am making a character rig (as a school assignment) for a low poly subd model. The rig itself is about done by now, but I ran into 1 anoying problem.
You see, my character has a prop, (i.e. a bag) which it can carry around. So the bag should then follow the movements and rotations made by the hand it is 'held' in, basically linked to the hand. This would then be the ideal solution, was it not for the fact that the bag could also be dropped, and thus stop following the hand movements.
What I'm trying to say is, I am looking to get a way to implement 'Link constraint' (which as far as i know is framebased) to a kind of radiobutton control scheme. Where i could simply switch what object it is linked to by changing the radiobutton status.
I do believe this should be possible.. How to set it up however, I do not.
You guys have any suggestions/tuts/tips?
01-14-2009, 08:20 AM
This morning I figured it'd probably be possible to assign an object's parent through maxscript, and as it turns out, it is.
So I just included a bit of code (-> on RadBtns state changed do (setparents)).
The only thing on my mind right now is that it's a bit more static (ie. I can't wire it to a parent, which I'd prefer) but ohwell, it'll do for now.
Still, if someone feels like pointing out a better solution, please feel free to do so.
01-14-2009, 08:29 AM
If you really really need to do it with a radiobutton or something similar, then you really really need some scripting. If you though... just need to find a solution how to parent from one space to another - you can search this forum for that kind of topics. I think they are like 5099823 threads like that now. You just need some constraints, and you need to animate their weights. No fancy stuff, just animate from one space to another.
01-14-2009, 03:53 PM
yeah you'll have to excuse my lack of searching the forums, internet was really giving me a hard time loading pages, so I kinda got fed up with it. That and MaxScript Reference wasn't being much of a help.
That aside, I've made a small script that lets me assign 1 out of X possibilities as a parent. So that's problem solved.
I still wonder how a more sophisticated approach would be constructed, but that'll be for some other time.
Thnx anyway though.
01-14-2009, 03:53 PM
yeah nice it double posted.. and I don't seem to find a delete reply button...
01-14-2009, 08:49 PM
Okay.. so I guess I was somewhat wrong.
I wrote this script:
fn parentNalign obj =
$.parent = obj
$.rotation = obj.rotation
$.pos = obj.pos
Parameters Par rollout:Ctrl
Stick type:#integer ui:(stickto)
rollout Ctrl "Board Controls"
radiobuttons stickto "Stick to: " align:#center offset:[-3,0] labels:#("Nothing",
"Back", "Left Hand", "Right Hand", "Left Foot", "Right Foot")
on stickto changed state do
if stickto.state == 2 then parentNalign $d_Board_Strap
else if stickto.state == 3 then parentNalign $Ctrl_Hand_l
else if stickto.state == 4 then parentNalign $Ctrl_Hand_r
else if stickto.state == 5 then parentNalign $Ctrl_Foot_l
else if stickto.state == 6 then parentNalign $Ctrl_Foot_r
else $.parent = undefined
custAttributes.add $.modifiers CA
It adds a set of radiobuttons in a rollout to the attribute holder, all works fine.
The FN part obviously lets me set a new parent, and also aligns it to its new parent. This too works fine.
However! when I close Max, and then reboot it later, my radiobuttons dont function anymore. atleast, it throws me an exception: ">> MAXScript Rollout Handler Exception: -- Type error: Call needs function or class, got: undefined <<"
And if I then delete the attribute holder and rerun the script to reattatch the radiobutton controls, it obviously works again... But you'll see that's no 'solution'.
Question is.. any idea how to solve said problem?
01-16-2009, 08:11 AM
You should better go for the constraint solution. Changing parents is not going to work with animation.
01-16-2009, 12:56 PM
heh yeah.. should have known that.. noticed the results immediately when tried to setup a simple test..
Still though.. there's got to be a way to nicely wire controls (in an atribute holder for instance) to use Link Constraint.
Might be there is.. but I'll figure that out when the time comes.
and this thread is now kinda redundant.. ~
01-16-2009, 12:56 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.