first of all, I am an animator and not well learned scriptor by now. But I tried to build a basic script, that creates a simple random camera-shake in MEL. What I’ve got so far is, create a Shake-Group with a Locator, bake tx & ty anim of Locator on a new animLayer by 1 frames, randomize the keys, integrate it to cam-hierachy and parent the cam.
But I ran into the problem, that I have to set start and end of the timeline for the bakeSimulation-Command manually. I tried by query min maxTime via int and string-variables, but it does not work. Is there any way to do that better?
Here is the script:
// Generic Camera Shake
// select the cam to shake it!
string $selectCam =
doGroup 0 1 1;
spaceLocator -n “cameraShake_LOC”;
parent cameraShake_LOC cameraShake_GRP;
select -add cameraShake_GRP;
string $selection =
string $snapCon1 =
parentConstraint $selection $selection;
// set timerange (start:end)!
bakeSimulation -t “1001:1101” -bol true -sb 1 -at tx -at ty;
rename BakeResults cameraShake_Layer;
// random keys from -2 - 2
keyframe -q -kc cameraShake_LOC.tx;
rand -2 2;
keyframe -e -at tx -in $i -vc $random cameraShake_LOC;
keyframe -q -kc cameraShake_LOC.ty;
rand -2 2;
keyframe -e -at ty -in $i -vc $random cameraShake_LOC;
pickWalk -d up;
string $camFather =
parent cameraShake_GRP $camFather;
parent $selectCam cameraShake_LOC;
print “The cam is shaking now! Have fun.”;