Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

smooth out the scaling of particles

smooth out the scaling of particles

mark_aldred
Advocate Advocate
255 Views
1 Reply
Message 1 of 2

smooth out the scaling of particles

mark_aldred
Advocate
Advocate

I have a bunch of particles and the camera moves towards them and through them. I'm scaling them down depending on the distance to the camera. What I'd like to do is have them scale down more once they come within a certain distance. I can do it, but the transition is abrupt. How would I make the transition from one state to the other smooth? Or, is there a better way I could script a controllable curve? Apologies - I'm not a programmer.

 

Here's the code and I'll attach the file ..

 

on ChannelsUsed pCont do
(
	 pCont.usePosition = true
	 pCont.useScale = true
)

on Init pCont do 
(
 
)

on Proceed pCont do 
(
	count = pCont.NumParticles()
	factor = 10	for i in 1 to count do
	(
		pCont.particleIndex = i
		dist = length(pCont.particlePosition-$Point001.pos)

		if dist > 250 then	
		scaleMultiplier = dist/20
		else
		scaleMultiplier = dist/30

		pCont.particleScale = scaleMultiplier
	)
)

on Release pCont do 
(
 
)

 

0 Likes
256 Views
1 Reply
Reply (1)
Message 2 of 2

mark_aldred
Advocate
Advocate

I thought I'd found a way to do it with a curve function, but I can't getting it working properly. I drew a curve on GeoGebra and got the formula for it. Then I inserted the formula into the script. The scaling seems to be much more linear than the curve should make it. I've attached the data and a screenshot of the curve.

 

Any advice welcome.

 

0 Likes