birth script with particleShape issue


#1

Hi,

I’m using a birth script to copy position and shape of en existing model.

I did this before and worked fine, but this time I get a problem… my model is not made of simple shapes, but of groups and it seems like it gives an issue to my scene.

I keep getting this error when calling the array containing the groups:

MouseTool:ScriptActionF649CE0
– Error occurred in i loop
– Frame:
– i: 1
– called in Proceed()
– Frame:
– pCont: ReferenceTarget:MaxscriptParticleContainer
– t1: -160.0

any help?

Thank you

Hal.


#2

Hard to say if you don’t post the actual script. It could be something as mundane as forgotten parentheses, or something more complex…


#3

nooch…thank you for reminding me of how distracted I can be :smiley:

here is the code:

on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.useTM = true
pCont.useShape = true
)

on Init pCont do
(

GLOBAL Vetro = $Lego* as array

)

on Proceed pCont do
(
t1 = pCont.getTimeStart() as float

 if (t1 < 0) do
     for i = 1 to Vetro.count do
         (
             pcont.addparticle()
             pcont.particleindex = pcont.numparticles()
             pcont.particleAge = 0
             pcont.particleTM = Vetro[i].transform
             pcont.particleShape = Vetro[i].mesh
         )

)

on Release pCont do
(

)


#4

If “$Lego*” is a group you will need to collapse the group objects into a eMesh or ePoly in order for it to work. You can work with objects within a group but not on groups themselves, not within a script, at least to my knowledge.

Someone may know of a workaround for this but it isn’t me :slight_smile:


#5

indeed JohnnyRandom, but I hoped I could do it in a script…I have 804 groups.

now that everything is been converted the script works.

Thanks for the support

Hal.


#6

quick reminder…how fo I transfer the original material from the mesh to the particles?

I have 6 different materials and would love the particles to pick them up when getting shape and position…

Thanks.

Hal


#7

You would need to use a sub-object material and assign material IDs in the script. Attached an example, notice the Material indexes assigned to the materials themselves in the multi/sub-object match the corresponding material IDs assigned with the Materiel Modifier.


#8

thanks JohnnyRandom.


#9

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.