Driving animation with math expressions...howto?

Is it possible to assign a math expression to ie the z value of an object, so that it goes up and down in time following a determined function?
(basically for my needs i’d like a way to create a sin function that operates an expression shape driver on its z position, so that my character breathes automatically over time, without having to assign thosuands of -1 to 1 keyframes…)

You don’t need to use a fancy expression driver for this. First set all the keys for 1 breath. Then open up the IPO Curve Editor. If it isn’t already selected, choose “Shape” in the IPO type menu. Now click on Curve->Extend Mode->Cyclic. This will make your breath animation loop forever.

Thanks a lot, that will do the job!
Anyway, for future rference, is it possible to use expressions to shape the ipo curves?

Yes it is possible. Do you know how to use python within Blender?
Open the text editor and type in the following:

import Blender

#Get the selected object
myObj = Blender.Object.GetSelected()

#Move the object 0.1 in the Z direction of the object
myObj[0].LocZ = myObj[0].LocZ + 0.1

#Update in the 3D View

You can execute this code by pressing alt P. Or you can have this script run during animation by enabling it through the script links window.

OMG :o

I didnt know you could run code within Blender :o :o

I have to investigate further…

Thank you :slight_smile:
That will do the job!