hi all,
i’m working on a little project where i want to create some streaks of energy. I’ve had some good luck getting the aesthetic i like with particles coming out of an emitter following a path, but it’d be really cool to add some ‘jitter’ to the path motion. I located and did a quick hack on the camera_jitter.py script to work on an object (my emitter) instead of a camera.
so i’ve got the emitter fluttering along a path with random jitter, but the particles appear to be generated before the jitter is applied, and thus don’t benefit from the emitter’s jittered motion.
any thoughts on something i could do to get around this?
thanks!
p.s. here’s an image of what i’m working on:
p.p.s.
here’s my quickly altered version of camera_jitter.py to obj_jitter.py:
#!BPY
"""
Name: 'Object Jitter'
Blender: 241
Group: 'Animation'
Tooltip: 'Adds Random movement to the current object.'
"""
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2006 Mariano Hidalgo
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
import Blender
from Blender import Scene, Noise
try:
import nt
os = nt
os.sep='\\'
except:
import posix
os = posix
os.sep='/'
def init():
# This controls jitter speed
Blender.sl = 0.025
# This controls the amount of position jitter
Blender.sp = 0.1
# This controls the amount of rotation jitter
Blender.sr = 0.25
# This Boolean controls wheter the jitter is always on or just when moving
Blender.moving = 0
def slink_mode():
time = Blender.Get('curtime')
scn = Blender.Scene.GetCurrent()
ob = scn.objects.active
print ob
if Blender.moving:
Blender.ps = (Blender.sl*ob.LocX, Blender.sl*ob.LocY, Blender.sl*ob.LocZ)
else:
Blender.ps = (Blender.sl*time, Blender.sl*time, Blender.sl*time)
rv = Noise.vTurbulence(Blender.ps, 3, 0, Noise.NoiseTypes.NEWPERLIN)
ob.loc = (Blender.sp*rv[0], Blender.sp*rv[1], Blender.sp*rv[2])
ob.drot = (Blender.sr*rv[0], Blender.sr*rv[1], Blender.sr*rv[2])
def script_mode():
try:
Blender.Text.Load(Blender.Get("scriptsdir") + os.sep +"obj_jitter.py")
except:
Blender.Text.Load(Blender.Get("uscriptsdir") + os.sep + "obj_jitter.py")
scn = Scene.GetCurrent()
scn.clearScriptLinks(['obj_jitter.py'])
scn.addScriptLink('obj_jitter.py', 'FrameChanged')
def show_prefs():
text = Blender.Draw.Create("")
jitterSpeed = Blender.Draw.Create(Blender.sl)
positionJitter = Blender.Draw.Create(Blender.sp)
rotationJitter = Blender.Draw.Create(Blender.sr)
mov = Blender.Draw.Create(Blender.moving)
block = []
block.append("The Jitter Speed")
block.append(("Jitter Speed", jitterSpeed, 0.005, 0.500))
block.append("Amount of POS Jitter")
block.append(("Position Jitter", positionJitter, 0.1, 2.0))
block.append("Amount of ROT Jitter")
block.append(("Rotation Jitter", rotationJitter, 0.05, 1.00))
block.append(("Only When Moving", mov, "Add random movement only when camera moves?"))
retval = Blender.Draw.PupBlock("Object Noise Preferences" , block)
if retval:
Blender.sl = jitterSpeed.val
Blender.sp = positionJitter.val
Blender.sr = rotationJitter.val
Blender.moving = mov.val
if Blender.link:
slink_mode()
else:
script_mode()
try:
print Blender.sl
except:
init()
show_prefs()