Like many situations, I need to convert water to foam, and I have more than one object in a scene, so I can't use the simple "onCollision" function. Since my problem is a waterfall that is emitting from within a shaped Object (a stainless steel blade to create a sheet flow), and I only need foam at the foot of the waterfall, I am trying to borrow Brandon Young's idea of using distance from one object to another to control where the foam particles get created.
Here's my initial simple code setup, without any of Brandon's randomization functions.
Code: Select all
# Original idea of using distance by Brandon Young
liquid = scene.get_PB_Emitter("WaterfallSheet_Type")
foam = scene.get_PB_Emitter("Container02")
waterfalltop = scene.getObject("SSBlade")
waterfallimpactpt = scene.getObject("tempBasin")
length = waterfallimpactptY-waterfalltopY # should always result in negative value
velMult = .01 # this adjusts the inherited velocity of the particles example .1 = 10% 1 = 100%
# Conversion Water To Foam based on length/distance from stainless steel blade containing
# waterfall sheet emitter
p = liquid.getFirstParticle()
nextp = p.getNextParticle()
if (p.getPosition().getY()<= length +0.5):
pos = p.getPosition()
vel = p.getVelocity()
velx = vel.x * velMult
vely = vel.y * velMult
velz = vel.z * velMult
newvel = Vector.new(velx,vely,velz)
p = nextp >
My problem is finding the correct syntax for the "GetParameter("Position.Y") statements for an object, and/or for creation of a new variable that would hold that value.
If I place Null Objects in the scene, as Brandon does, and position them at the locations of each of my two objects, the above statement
" waterfalltopY=Null01.getParameter("Position.Y") "
works just fine. But I would prefer to not be forced to place Null Objects in the scene just to make this happen. The locations of these have to be positioned by hand. It seems simpler to just use the Y location of the objects themselves, and create a variable for this location value.
Isn't there a way to write a statement like this for my "waterfalltop" variable (or for the "SSBlade" object) that would return the value of "Y" - so as to create a variable called something like "waterfalltopY" ??????
I haven't been able to find any clues in the Realflow 2015 Scripting Reference doc, or come up with anything through brute-force experimentation. What is the proper command syntax. Sorry about this - I'm still in the early stages of learning Realflow2015 Python.