[RF] Targeting in Realflow
Realflow, Scripts August 2nd, 2009
It’s rather quick tip, not script
Normally to target an object, You would have to play with matrix but Realflow have better way.
You can easily define any kind of emitter and target object (it’s better to use Null object that You can parent to anything You want )
Paste script below on “event script editor”, over “onSimulationStep” definition.
#-------------------------------------------------- # Function: onSimulationStep #-------------------------------------------------- def onSimulationStep(): #-------------------------------- # Define emitter and target object here emitter = "Square01" TargetObject = "Null01" #-------------------------------- emit = scene.getEmitter(emitter) null = scene.getObject(TargetObject) axis = scene.getAxisSetup() if axis == AXIS_SETUP_YXZ: startVec = Vector.new(0.0, -1.0, 0.0) elif axis == AXIS_SETUP_ZXY: startVec = Vector.new(0.0, 0.0, -1.0) elif axis == AXIS_SETUP_YZX: startVec = Vector.new(0.0, -1.0, 0.0) nullpos = null.getParameter("Position") emitpos = emit.getParameter("Position") pointVec = nullpos - emitpos rotVec = startVec.getEulerAngles(pointVec) emit.setParameter("Rotation", rotVec) pass
And [SAMPLE] scene