PDA

View Full Version : triggering event


Wheiraucher
06-03-2008, 12:12 PM
Hi everyone.

This is probably easy, but I couldn't to find a solution. I want the bones in a rig to change their color to red if they get overstretched. That's all, but I don't know where to trigger this event.

david

ZeBoxx2
06-03-2008, 12:24 PM
In max2009, probably using the node event system.
In earlier versions, I'd say in the viewportChange callback, or using the viewport redraw callback functionality; they more-or-less do the same thing, getting called whenever the viewport redraws due to a change in it, but the former is easier to manage than the latter (imho).

Alternatively, you might be able to do something with a script controller; I don't think an expression controller would work as there's no wireframe color track..

Wheiraucher
06-03-2008, 12:57 PM
Unfortunately I don't have Max2009 but am still using version 9. Can you explain the viewportchange callback a little better. I have no idea of where to put my script yet.

thanks, David

hotknife
06-03-2008, 01:37 PM
To do this I'm assuming you have stretchy bones in yor rig. The Bone actually has a Bone.length property when created but does not sow in the Track view.

You can place a script in the Width track for exemple which will then control the colour of the bone by calculating the distance between the bones child and itself and comparing that to the original.

Please see the attached file and look at the example bone and particular the script controller in the width of the bone. This could become more complicated should you wish the bone to fade to red or green but I'm just having a cup of coffee and they don't last that long. :)

Wheiraucher
06-03-2008, 02:01 PM
hey hotknife, thanks for your effort to help. You were right with your assumption about stretchy legs :-) . Unfortunately I cannot open your scenefile. Are you sure you are using 3DSMax 9 (SP2), and not a newer version. That's the only explanation I can think of. Could you try sending me the file with a different configuration or so? Or post the script and a screenshot?

You might need to drink another coffee :D

hotknife
06-03-2008, 02:23 PM
Sorry - more coffee . - grab the point and Pull. Ahem....

This is a V9 version.....with the script in the Front Fin........Actually not sure I am correct about the bone.length value but it does change colour when stretched - but think I will have to look up the meaning of the bone.length in the help file.

If the length value is incorrect (which I think it is )when could do a manual check on it's length when we create the bone and add that as a variable which would work. using the position of the bone - its child.pos - like I did in the script.....

Wheiraucher
06-03-2008, 02:55 PM
ok, this version worked. Script is working as well. thanks a lot. This is probably the solution I was looking for. the bone becomes red when overstretched. Will use the script in my future rigs :-)

David

hotknife
06-03-2008, 03:09 PM
no worries just check that bone.length....I don't think it's right

PiXeL_MoNKeY
06-03-2008, 04:18 PM
Chris Thomas also posted a tutorial on this over at the CGAcademy website (http://www.christopher-thomas.net/pages/free_tutorials/tut_scripted_length_color/tut_scripted_color.htm).

-Eric

LoneRobot
06-04-2008, 08:32 AM
just a note on that tutorial - the dependson is no longer needed, as you can create a weak reference to the objects using the "Assign Node" button.

Wheiraucher
06-04-2008, 12:23 PM
Chris Thomas also posted a tutorial on this over at the CGAcademy website (http://www.christopher-thomas.net/pages/free_tutorials/tut_scripted_length_color/tut_scripted_color.htm).

-Eric

hey cool. Someone has written a tutorial about this. that's great. Why haven't I seen this before? thanks.

David

CGTalk Moderation
06-04-2008, 12:23 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.