Generating splines between particle positions

Hi, there are scripts which generate splines of particle paths,
but how do i generate a spline between particle positions?

making a spline out of one frame of particle positions?

here is some starting information we could use, i just dont know how to assemble it:

--------------------------------Creating shapes-----------------------------
for i in 1 to numParts do
(
newShp = splineShape()
addNewSpline newShp
newShp.name = (shNm + i as string)
allShps += #(newShp)
)--end For
-------------------Adding Knots to Splines at specified intervals-------------
for t in fStrt to (fEnd/incr) do-- the "to" number here defines the multiplier or total number of knots
(
sliderTime = (t * incr)--sets the sliderTime multiplied by above number
for i in 1 to numParts do
(
pf.particleIndex = i
pId = pf.particleID
if pId != 0 then
(
pfShp = execute ("$'" + shNm + pId as string + "'")
addKnot pfShp 1 #smooth #curve pf.particlePosition
)--End If
)
)--End For

guess we need to create a spline by adding a knot for each pf.particleID at its pf.particlePosition (in one frame)
-pf.particleIndex = i
-pId = pf.particleID
-addKnot pfShp 1 #smooth #curve pf.particlePosition

*********************
i want to convert each particle into a spline knot so i can connect them anyway i want

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
W DIGITAL's picture

anubis, what you say i cannot

anubis, what you say i cannot agree with,
i try as much as possible to do it myself, but like i said im not a programmer, its hard for you to imagine there are people that just are not code compatible,
i even looked in the maxscript help for random parameters,
then i tried putting random infront and behind the posArray parameters, of course it didnt work

first of all

1) i dont expect you to write a complete tool for me, i posted my question here for anyone else to help me as well, i wrote you the email because i was thinking maybe its easy for you, im sorry i wrote that email

2)im sorry to say but they are not connected randomly, do you want a screenshot, i can prove it to you, at least that way you dont think i am full of nonsense all the time!!!!!!!!!

Anubis's picture

OK, lets fix the terminology

OK, lets fix the terminology first to not become disappointed each other ;) I was use "particleIndex" in the code to collect their position, not "particleID". But lets to say in your case they match (ie particleIndex[1] is the same as particleID[1]). Well, if this is the case, Ok, they are not random.

So, what's next? You'll need additional randomization of collected data (posArray) before create a spline. So just do it using Max random() function. It's only one as I said. The difference is only how you will used it. Even here (in the forum) "random" is discussed in many threads. And yes, they may not concrete binded to the particle position, but this is not important, the "logic behind" is the same.

Also you say - nothing in the help. Nope, everything is there :) Yes, no examples for everything (and never will be), but think yuorself, if is everything already done and writen inside then the sites and forums like this will never exist :)

There is why I say you not make effort to find the way, and "to find the way" for me not means "copy/paste existng code". Also cannot agree with you so you must to be a programmer to work with MaxScript. Em I programmer? LOL

Well, let tell you more about me. I think too so I'm not code compatible person! Yes, I was playing with many languages, most of them scripting, and with most of them just for fun. But... am not go too far (LOL). The words like "script languages are user friendly and they are designed for NOT programmers" alway was sound for me like a joke. But now I can say for sure so this words are TRUE. And the MaxScript use really "humane" code. Think about it as one of the Max features, because it is exactly that. So, without understanding how the Max and it features works no progress coming.

And finally to not say what I'm talk more but help less, I'll ponter you to this topic:
http://www.scriptspot.com/forums/3ds-max/general-scripting/random-object...

But am sure you will ask again how to use the example code posted there, oh, I'll write you an example. So, in above script (posArray) you have 2 steps and you need to insert a new randomize step in between them.

tmpArray = #() -- temp empty array
 
for data in posArray do
(
    miniArray = #() -- another temp array
    while data.count > 0 do (
        rndIndex = random 1 data.count
        append miniArray data[rndIndex] -- add to miniArray
        deleteItem data rndIndex -- remove it from data
    )
    append tmpArray miniArray -- build multiarray
)
 
posArray = tmpArray -- last step here
-- now all pos.data is randomized and ready for the next step (spline creation)

Finally, inserting this code after step 1 in above code and tadaaa... what's happen (?) - am done your job. But if you now continue with "ok, but my specific issue is... and I with to make this... like this...", well, you can guess what I'll say, right? I give you enough help support :)

Cheers
Anubis

my recent MAXScripts RSS (archive here)

W DIGITAL's picture

yes you have, and trust me i

yes you have,
and trust me i am very thankful!!!
you are the most helpful person on this site!!! :)

but, since i DO wnat to understand, and not just copy and paste,

how would i have figured out to write all this

tmpArray = #() -- temp empty array

for data in posArray do
(
miniArray = #() -- another temp array
while data.count > 0 do (
rndIndex = random 1 data.count
append miniArray data[rndIndex] -- add to miniArray
deleteItem data rndIndex -- remove it from data
)
append tmpArray miniArray -- build multiarray
)

posArray = tmpArray

where do i find information in the helpfile which helps me write codes like that BY MYSELF????

i really want to learn some essential stuff, so i dont have to ask all the time (i hate to ask :( and i always feel bad for taking up others time, )

Anubis's picture

I glad to hear you wish to

I glad to hear you wish to learn, and don't worry, nothing comes for a day or week of practice. You'll build your own style, step by step, you know :)

Best wishes

Anubis

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.