Sunday, December 23, 2012

Gradually 'freezing' particles


Sometimes I needed to gradually decrease the SPH-based particles velocity until they're completely stopped. A bounded Drag daemon is an effective way to apply a 'braking' force to your particles, but if you want to apply such forces in a smooth & progressive way, you may find interesting the following script that I made as an Event script. 

See a sample video here:

video

So, let's do it. First of all, press Ctrl + F2 to open up Simulation Events window and right clic over Frames Post.

In the pop up window add the following code (replacing the "Circle01" string with your emitter's name): Download
  • increment is the reduction factor of the velocity. Higher values means less reduction, for instance 0.99 will barely reduce the velocity frame by frame all along the timeline, while 0.10 will drasticly reduce the velocity of your particles in a short time.
  • threshold stands for the minimum velocity of the particle prior to get completely frozen.
  • minlife is the minimum life (in seconds) of the particle prior to apply the braking force.
Once your values are set up you just need to clic OK and Simulate.

You'll have noticed that the particles are frozen by setting up their velocity to 0,0,0 (what is described in the script as 'zero_velocity'). Once these particles are completely stopped they can still react and move if other particles collide with them. However you may want that once the particles are stopped in a first term, they keep completely frozen even though other particles / forces collide with them. In that case you just need to uncomment the particle.freeze() line by removing the ## symbols and add them to the previous line in order to comment the 'set velocity to zero_velocity' instruction.

IMPORTANT: Make sure your tabbing is OK if you copy/paste code. Your leading indents should appear pretty much like these ones (click on the image to enlarge):

4 comments:

Ryan JVR said...

Hi
Thank you for the script.
Im having a problem with it in realflow 2013. I keep getting this error - WARNING: Script error: "name 'scene' is not defined" at line number 4.

The only difference i can see on my side compared to your screen shot is the word getEmitter is gray and not yellow like in 2012?

Thanks
Ryan

Ryan JVR said...

Nevermind found the problem. Turns out getEmitter has been stopped in 2013. It's now get_PB_Emitter.

Thanks anyway

Tung Nguyen said...

thanks for share. I make successfully




biet thu dep 3 tang
biet thu dep
giuong ngu gia re

黃文彥 said...

真愛旅舍視頻聊天室
真愛旅舍視頻聊天室
真愛旅舍視頻聊天室
真愛旅舍視頻聊天室
同城交友異性聊天室
寂寞同城交友聊天室
美女視頻聊天交友
美女視頻聊天交友
夫妻真人秀聊天室
夫妻真人秀聊天室
夫妻真人秀視頻聊天室
台灣一對一視頻聊天室
台灣一對一視頻聊天室
俺去也成人視頻免費在線播放
俺去也成人視頻免費在線播放
成人午夜色情視頻
成人午夜色情視頻
日本美女免費黃色視頻聊天室
約炮門-同城找床友
真人美女交友視頻聊天室
同城午夜免費交友網站
性感美女短裙快播情色視頻
成人倫理人妻熟女
日本美女AV裸體視頻
午夜同城交友聊天社區
夫妻視頻交友QQ群
黑色絲網襪美女視頻
視訊美女
真愛旅舍視頻聊天室
同城視頻聊天室
同城視頻聊天室
真愛旅舍視頻聊天室
0401影音視訊聊天室
真愛旅舍視頻聊天室
真愛旅舍視頻聊天室
免費視訊
同城視頻聊天室
真愛旅舍視頻聊天室
床友交友約炮
真愛旅舍視頻聊天室
真愛旅舍視頻聊天室
真人裸聊
色情聊天室
真人裸聊
真愛旅舍視頻聊天室
色聊聊天室裸聊視頻網
小可愛視訊聊天室
小可愛視訊聊天室
小可愛視訊
173免費視訊
玩美女人聊天交友網
同城午夜聊天室
showlive影音視訊聊天網
韓國美女主播聊天室
579真人視頻交友網-美女主播熱舞視頻
美女主播熱舞視頻
性感韓國美女主播視頻
真人視頻聊天室
午夜視頻秀場
免費的成人午夜劇場
免費視頻找女人聊天
如何找聊天室主播視頻
美女主播性感熱舞視頻
成人視訊
韓國視頻交友聊天室
聊性聊天室