It just so happens that "time" is a special variable, because it is shared by multiple programs you'll be using. They all know what "time" it is. As such, "time" has its own function for setting it called "set-time!".
This should be used for setting the value of time, instead of "set!" so that other programs get informed of the update to "time". If you are only running ox and icam, using "set!" is fine, but when the program "aardvark" is added to the mix...
For example, to set the current time to frame five, one would type:
ox --> (set-time! 5)Time is like "render" in that, when it is set, the world is reevaluated. Ergo, never, ever set time within the world construct. The result is an infinite loop.
As an example, you might have an avar called, "squash" which controls the flattening of a ball. To find the amount of "squash" at the current time you just need to call "squash" like a function:
ox --> (squash) 0.5To find out the value of "squash" at some arbitrary time, you just give squash the desired time as an argument:
ox --> (squash 30) 1.5
Below, the robot arm example from the hierarchy section is used in a model, to make use of avars:
(load "robot-arm.al") (world (model "arm" (elbow-bend wrist-bend) (robot-arm (* 90 (elbow-bend)) (* 90 (wrist-bend))) ) )This will create a model called "arm" with two avars, elbow-bend and wrist-bend. I have multiplied both by ninety so that the avar values can be normalized to a range of zero and one, which is easier to work with, and change later.
The values of elbow-bend and wrist-bend are passed to the function robot arm which creates an arm with the wrist and elbow bend accordingly.
Once this model has been created in ox, two other programs can be started, "hview", and "aardvark". The first, "hview", allows the user to examine the hierarchy of models and avars that have been created in ox, and to select them for editing. The editing is done in "aardvark".
Here elbow-bend has been selected. Usually an avar is selected when you wish to edit it. This editing takes place in the program "aardvark" which looks like this:
Aardvark was finished yesterday. Documentation will be arriving soon. For now, the accadman manual for xavar, a previous incarnation of aardvark should suffice, for the most part.
(load "robot-arm.al") (define (make-arm-model) (model "arm" (elbow-bend wrist-bend) (color '(1 0 0)) (surface "matte") (robot-arm (* 90 (elbow-bend)) (* 90 (wrist-bend))) )) (define (ground) (separator (color '(.1 .3 .2)) (rotate 90 x-axis) (surface "matte") (disk 'radius 100))) (load-avars "double-sneeze.adb") (set-time! 0) (while (< time 90) (begin (world (light "spotlight" 'from '(-5.5 3 1) 'to '(0 3 0) 'intensity 50) (camera "main" "perspective" 'from '(0 2.5 4.5) 'to '(-.5 1.25 0) 'fov 45) (ground) (make-arm-model)) ((render 'reset)) ((render 'to-file) (string-append "Frames/frame." (number->string time))) ((render 'set-option!) '(ri-format 320 242 1)) (render "main") (set-time! (+ time 1)) ))
(Crummy mpeg, needs much tweaking...)
ox --> (save-avars "myAvars.adb")To reload a set of avars that have been previously saved, use:
ox --> (load-avars "myAvars.adb")