# Path for camera from motion equation

Is there any option in blender to define path as equation?
I need to move camera by specific equation of motion. This equation is described as follows:

x = cos(t) + 0.5 * cos(4*t)
y = sin(t) + 0.5 * sin(4*t)
z = sin(4*t)

• You might be able to use a driver, but I'm not sure. – gandalf3 Jan 12 '14 at 3:17
• You may have to use Python scripting for that. There is another page here on StackExchange that has some solutions for this. stackoverflow.com/questions/8865672/… – MarcClintDion Jan 12 '14 at 7:12

Add a single key frame to the camera the go to the f-curve editor. Selcet the curve for the desired coordinate. Go to the proverties panel of the f-curve editor (if you don't have it press N to get it)

You're looking for a "sin" type for each of your coeficients. For example I'll do the X location formula you provided:

Remember to check the "additive" option if your have more then one term in your equation To enter "cos" you need to use the fact that cos(x)=sin(x+pi/2) Wikipedia: Trigonometric identities

Final graph for X location:

Extension:

In your case you only needed sines and cosines, but it it would be nice if we could do it for any function. It would be nice if we had a any function modifier, but for now heres a work around: This method is inspired by @gandalf3 comment

Add a driver to the property you want to control using a equation

Then head over to the graph editor, and change from the f-curve editor to the driver-editor. Select the property you want to add an equation to on the left hand side. Now head over the the properties panel.

There change the variable type to "single property" and select the current scene object (You must first select a scene object type). Then type in "frame_current" into the path box. If you want you can name your variable (I called mine "t")

Now all you need to do is enter your equation into the box "Expr:" Remember that this is a python expresion so a quadratic function is x**2 not x^2

If you get an error saying somthing about "Python Auto-execution disabled: reference this question.

According to the wiki, 2.70 will have support for "Basic operations from python/BKE_unit (+, , *, etc.), and math constants and functions (pi, sin, etc.)." This combined with something I read (and can't find again, atm) which indicated that many more scene variables (like #frame) will be exposed to the input boxes, should mean that you can just type the function in ;-) ...eventually

Not sure if you want to run a pre-release build, or wait that long, though ;-)