Script for Cloth modifier


#1

Hello everyone.

First of all, i´d like you to know that im a beginner to MaxScript and scripting in general.
Started learning it by studying the MaxScript Help/Documentary/Reference pages and watching the 101 Tutorials by John Wainwright etc.
I can pretty much say, that wasn´t enough to write my first script or give me a clue on how get started. Especially regarding the matter i started learning MaxScript in the first place, which is the cloth modifier.
Working with it for animations alot, can say im pretty much experienced. As powerful as it is, there are situations, where it messes up the mesh completely, due to different poly sizes and forms or even velocity of the mesh. Solving this issue with just the cloth group parameters didn´t work. Tried that for a long time and saw alot people struggle with this, which i could only offer a workaround…

In a nutshell: I want to write scripts, which automaticly changes values for each vert of the mesh in respect of poly size, form, bend, velocity and so on.

To begin with i´d like to ask your help in formulating a code that can change the cloth density, when a poly is stretched above limit while simulation is running. All i have so far is this:

If – poly reaches/stretches a certain size/length
Then ..density: float – decrease value
Else – keep default value

Appreciate every help/suggestion you can come up with and if there is something unclear with my matter (i bet there is) please ask me.
Thank you in advance!