Page 1 of 1

Flying snow

Unread postPosted: Mon Oct 10, 2011 9:46 pm
by styckx
I've always wanted this, and in theory know how it can be done but.. My LUA knowledge is a big fat.... ZERO

Particle emitter attached to the bottom of a loco as a child object to a `winter specific' train. Write lua script to control particle emitter based on speed.

Profit? Anyone with spare time want to guide me through some "lua for dummies" ?

http://www.youtube.com/watch?v=iKnwF1CdMHc

Re: Flying snow

Unread postPosted: Mon Oct 10, 2011 9:56 pm
by PapaXpress
well at least you aren't asking for this:
http://www.youtube.com/watch?v=1gF0cE12 ... re=related

Re: Flying snow

Unread postPosted: Mon Oct 10, 2011 10:37 pm
by ca2kjet
No way! That's right down the street from me. This would def be an awesome addition to TS2012!

Here's a shot taken down the same line. Would love to see that effect!

Image

Re: Flying snow

Unread postPosted: Tue Oct 11, 2011 1:11 am
by Kali
I can do when I've got a spare minute, Bill. In theory all you need is this:

Code: Select all

SOME_MAX_SNOW_AMOUNT = 0.08 ( number pulled from thin air! )

function Update( p_interval )
... other stuff that's already in update

  lnSpeed = math.abs( Call("GetSpeed" ))
  lnSnowRate = 1 - ( SOME_CONSTANT_SNOW_RATE_MULTIPLIER * lnSpeed )
  if lnSnowRate < SOME_MAX_SNOW_AMOUNT then
    lnSnowRate = SOME_MAX_SNOW_AMOUNT
  end
  Call("SnowEmitter:SetEmitterRate", lnSnowRate )

.. and more stuff that's already in update
end


But emitters are quirky & usually need some tuning. That is the basic functionality though, have a look at some smoke code to see how to tune them better. One point: Emitter rates work backwards, the smaller the number the more the emitter puts out.

Re: Flying snow

Unread postPosted: Tue Oct 11, 2011 8:31 am
by micaelcorleone
You should have a look at the ZZASnowplow from Just Trains.
It has a similar effect: The faster it goes, the more particles it creates.