ScriptSpot

Forum topic · General Scripting

how to randomize particle position after custom particle birth script from orbaz ?

By piotradamczyk · 2012-04-17

Description

here's the script from orbaz's site.

on ChannelsUsed pCont do
(
pCont.usePosition = true
)

on Init pCont do
(
global obj=$Shape11 --object with selected verts
)

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

if (t1<0 and classOf obj==Editable_Poly or classOf obj==Editable_Mesh) then (

for i in obj.selectedVerts do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles() -- last particle that was added
pCont.particlePosition = i.pos
)
)
)

on Release pCont do
(
)

The problem is that the particle placement creates repetitive patterns when scattering few group objects in one shape instance node.

How can i randomize particles (change their position seed) after setting their birth in birth script?

Comments (1)

mark pigott · 2012-05-17

Add this after pCont.particlePosition=i.pos

CurPos=pCont.particlePosition
CurPos+=pCont.randSpherePoint()*50 ---this will give 50 random units, xyz
pCont.particlePosition=Curpos

It should work, if not get back to me