|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Other Language - Assistance with maxscript please!?
First I would like to say that I am not a programmer. In fact, I hate it. However, I have an idea for a useful script for 3ds Max and I have been struggling with the code. Basically it is to create a "giggle" in weighted systems in relation to a parent selection. There are two basic ways to get this: a "lag" portion that allows the weights to trail behind the parent object and a giggle portion which continues the path of travel along the axis with a sin order of harmonic degredation in the movement. This code is incomplete so I hope that you guys can follow it. I would greatly appreciate any and all help that I can get. I included comments to help clarify what I am trying to achieve.
-- core giggle code -- values needed and defined p_vert = get vertselection $parent01 --This is to get position values for the parent selection. I am assuming that this will bring the avg. value of the selection back ie. pivot point global p_int = 0.0 --set variables for parent position global p_final = 0.0 global dampening = spinner global resistance = spinner --seperate values that change final position of child vertices by a percentage ie: 0.00 - 1.00 global startbakeframe = spinner global endbakeframe = spinner --automate key creation --some of the variables are not used yet in the code so I just use generic naming to identify placement. Actual code will be written at a later date, once I figure this out. --Lag and initial state code-- for i = startbakeframe to endbakeframe do --starts frome bake and sets initial variable ( at time i p_int = getvert p_vert --pulls initial condition for parent position at time i+=1 p_final = getvert p_vert --pulls final condition for parent position lag_int = (p_final - p_int) --establishes distance covered by parent. I may need to pull all 3 coord., unsure. for t = 1 to getNumverts $child01 do --sets up the loop to affect all the child vertices in relatoin to the parents movement ( vertex_int = getVselectweight [t] --I think this retrieves the weight value of vertex at point t. vertex_final = vertex_int * 1.00 --the weights are a fraction and I need the inverse to make the numbers work as far as the child vertices closest to the parent move the least. lag_final = lag_int * vertex_final --this is so the distance moved is a percentage of the parent move move_value = [lag_final,0,0] --this part will be repeated in the code for each axis of movement animate on at time i polyop.movevert $child01.vert [t] move_value --this, I think, would actually create the keys ) When lag_int = 0 do --this is to activate the giggle part of the code. this section I am unsure about. ( c_int = 0.0 c_final = 0.0 j = i - 2 --this is to reverse the bake frame back two frames, I am not sure if this is the right way to do it but I need the velocity of the parent to affect the giggle and this is the only way I could think of to write it. at time j c_int = getvert p_vert at time j += 1 c_final = getvert p_vert --this is to obtain the velocity by distance traveled in one frame amp = (c_final - c_int) * dampening --this is to determine the magnitude of how long it will go freq = ((c_final - c_int) / 1)) * resistance --this is to determine how far the child vertices will travel k = j -- variable switch so j value is not changed k += 1 for s = 1 to getnumverts $child01 do --this is so all the child vertices get moved at that frame ( child_int = amp * sin (freq * i) --this is the actual working distance the child will travel. I haven't yet figured out how to make the bake frame set keys after the parent has stopped. This equation will have to continue to move the child vertices after the parent stops which is why I don't want the j values changed yet. vertex_int = getVselectweight [s] vertex_final = vertex_int * 1.00 --agian this is to get an inverse value so the child vertices closest to the parent move the least. child_disp = child_int * vertex_final --again this is to get a percentage of movement based on the equation movevaluechild = [child_disp,0,0] --this part will be repeated in the code for each axis of movement. Animate on at time k polyop.movevert $child01.vert [s] movevaluechild ) ) ) I know that the code is not complete and is kinda in the middle but I think I have most of the other stuff figured out, it is just a matter of organizing it into code. The other problem I am having is figuring out how to incorporate soft selection into my rollout so that I can use it as my vertex weight system. Anyway, I know that this is rather long but I would greatly appreciate any help. This is going to be used to help with better breast, belly, and soft tissue movement in my animations. I also plan to give the preliminary script away for free and then enlarging it for more areas once this basic part is finished. Thanks again. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Other Language - Assistance with maxscript please!? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|