PDA

View Full Version : birth script with particleShape issue


Halford
01-23-2011, 10:31 PM
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.

noouch
01-24-2011, 08:43 AM
Hard to say if you don't post the actual script. It could be something as mundane as forgotten parentheses, or something more complex...

Halford
01-24-2011, 09:46 AM
nooch......thank you for reminding me of how distracted I can be :D

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
(

)

JohnnyRandom
01-24-2011, 06:34 PM
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 :)

Halford
01-26-2011, 09:48 AM
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.

Halford
01-27-2011, 11:05 AM
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

JohnnyRandom
01-27-2011, 06:36 PM
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.

Halford
01-28-2011, 09:07 AM
thanks JohnnyRandom.

CGTalk Moderation
01-28-2011, 09:07 AM
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.