10
$\begingroup$

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)
$\endgroup$
  • 1
    $\begingroup$ You might be able to use a driver, but I'm not sure. $\endgroup$ – gandalf3 Jan 12 '14 at 3:17
  • $\begingroup$ 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/… $\endgroup$ – MarcClintDion Jan 12 '14 at 7:12
7
$\begingroup$

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)

Add a Built-In Function modifier

Built-In function modifier

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

X location

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:

Final Graph

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 Adding driver

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")
Variable

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

Equation of motion

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

$\endgroup$
1
$\begingroup$

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 ;-)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.