Notifications
Clear all

[Closed] particles to center of the groups

Hi!

I have about 200 groups called Group1, Group2, Group3… to Group199,
Group200, etc… Each group is a instance of one group.

Now I would like to create 200 particles (Matching the number of the groups)
and set them to the center/pivot point of each Group so that when I move
the particles, the groups will follow along…

How would you do this kind of a thing?

Thanks in advance…

-Samulih

6 Replies

I did get the particles to the right place (to pivotpoints) with a codeline
by Allan McKay in my ParticleFlow Birth script:


on ChannelsUsed pCont do
(
pcont.useposition = true
pcont.useshape = true
)

on Init pCont do
(
global groundGeom = $Group* as array

)

on Proceed pCont do
(

t1 = pCont.getTimeStart() as float
t2 = pCont.getTimeEnd() as float

if ((t1 <= 0) and (t2 >= 0)) then
(
    (
    pcont.addparticles groundgeom.count
    for i in 1 to groundgeom.count do
        (
        pcont.particleindex = i
        pcont.particleposition = groundgeom[i].position
        )
    )
)

)

on Release pCont do
(

)


Now I am trying to find a solution for grouping my Groups to the particles…
In the code by Allan McKay there was a line

pcont.particleshape = groundgeom[i].mesh

in the for-loop between the lines “pcont.particleindex = i” and “pcont.particleposition = groundgeom[i].position” but this didn’t work with Groups. [b]

Could someone find a solution to Parent my Groups to the particles in the
same for-loop?[/b]

Thanks in advance!

-samulih

The birth code you have should work. You could also use .particleTM and .transform properties instead of .particlePosition and .pos to align both position, rotation and scale.

To keep the objects moving with the particles, take a look at the example
http://www.scriptspot.com/bobo/mxs5/pflow/pflow__MovingObjects.htm

It uses Helpers instead of groups. You probably don’t want the line
My_Athmospheric_Gizmos_01[i].radius = 10 + pCont.ParticleAge*2
which was used to change the size of the helper over time.
The rest should be rather obvious…

Hi and Thank you very mych Bobo!

And so… Now I am asking that could there be a problem with
the thing that I have 200 instance copies of my group?

I was just wondering because you have written in the Particle
Motion Transfer to Scene Objects -document that:

“enter 29 to create 30 copies of the Sphere Gizmo (NOT Instances!)”

thanx again!

-samulih

1 Reply
(@halfvector)
Joined: 11 months ago

Posts: 0

He makes copies instead of instances because he wants every sphere gizmo to have independent radii. As you can see here:

My_Athmospheric_Gizmos_01[i].radius = 10 + pCont.ParticleAge*2

he changes the radius for each particle based in its age. So if gizmos were instances, all gizmos would have the same radius at the end.

So if the only thing you want to change in your groups is the transformation matrix, it doesn’t matter if objects are copies or instances.

Greets.

Oh, indeed!

I should read and translate the lines first before I open my mouth

I will try your tips tomorrow… thanks to both of you!

-samulih

yep that codes old and crummy, bobo’s right. It’s best to use transforms as you get orientation and scale from it too, which is more accurate