Random movement for animation

what’s the best / fastest way to give an object random 3d movement? this is for animation, not a game - I am going for a 3d curve write-on effect, so a single point moving in 3d is all I need, and the particles will trace behind it…

in aftereffects you just type a one-word expression with a frequency and magnitude input and it will jiggle the keyframe ipos for you. anything like this in python, or even easier?

This can effectively be done in python, using append(point) in the IpoCurve module where “point” could be a random x,y tuple coordinate for each of the LocX, LocY and LocZ curves. Check http://www.blender.org/documentation/242PythonDoc/index.html

you can also use the “[]”'s with something in the object api to set or get locx etc. per time…

hi, you can use this (use in scripts directory, but you try open and watch in it)

http://claudiojd.googlepages.com/IPO_generator.py

salvar = save settings in a internal regular text in blender.
step = amount of frames to add keys
channel, writte in it the name of channel (warning, case sensitiyve) watch on ipo window the legal channel names.

Object select the active objet for process

this create a bew datablock , the new datablock can manually link to object, to prevent unlikes changes. (datablock ipo name start with object name and ending with “_hazar”)

regards

CJD

Here is one way to do it.
X is the magnitude
“Cube” & “SPhere” can be replaced with other object names.

Running this script on frame change must be on

IMPORTANT NOTE: Do not run this in project that you have put lot of time into or commercial work. Unless you KNOW it will not mess up a project.

Here is how to set up a scene for test: Animate movement/Loc of default cube. Make a uvsphere to same location as the cube is in frame #1.

import Blender as B
import random as R
x = 3            #CHANGE THIS         
ob = B.Object.Get("Cube") #OBJECT TO FOLLOW
a = ob.loc
locx = a[0]
print a[0]    #line for development
locy = a[1]
locz = a[2]
ob = B.Object.Get("Sphere") #OBJECT THAT FOLLOWS + RANDOM motion
#generate random numbers
rx = R.randint(-x,x)/10.0
ry = R.randint(-x,x)/10.0
rz = R.randint(-x,x)/10.0
 
# combine random and location
rx_ = rx + locx 
ry_ = ry + locy
rz_ = rz + locz
#assign location
ob = B.Object.Get("Sphere")
ob.LocX = rx_
ob.LocY = ry_
ob.LocZ = rz_

Object jitter is good:
http://uselessdreamer.byethost32.com/object_jitter.html

I don’t know if it’s been updated lately, but when i downloaded it i had to change the “Group” to “Animation” rather than “Help” which didn’t exist.