You have stumbled upon something which has plagued us since we began the alice project: order of operations matters in linear algebra (and it bites you hard when you do moves and turns together).
Here's some example code:
DoTogether DoInOrder box roll left 1/4 box roll right 1/4 DoInOrder box move forward 5 box move backward 5
Looks great. Each second line inverts its first line. Why doesn't it produce the desired inverse when the animation engine gets a hold of it? Well, it gets broken up into a whole bunch of RollALittles and MoveALittles.
frame # start first lines RollALittle Left MoveALittle Forward frame RollALittle Left MoveALittle Forward frame RollALittle Left MoveALittle Forward . . . frame # - start second lines RollALittle Right MoveALittle Backward frame RollALittle Right MoveALittle Backward frame RollALittle Right MoveALittle Backward . . .
Since order of operation matters, to produce an inverse each step must be mirrored. The MoveALittles need to come first in the inverse frames.
+---------------------------------------+
| |
| +---------------+ |
| | | |
V V V V
|
RollLeft MoveForward | MoveBackward RollRight
Rewriting the code to look like:
DoInOrder DoTogether box roll left 1/4 box move forward 5 DoTogether box move backward 5 box roll right 1/4
Produces:
frame # start first lines RollALittle Left MoveALittle Forward frame RollALittle Left MoveALittle Forward frame RollALittle Left MoveALittle Forward . . . frame # start second lines MoveALittle Backward RollALittle Right frame MoveALittle Backward RollALittle Right frame MoveALittle Backward RollALittle Right . . .
Which works like a charm. (I'm sorry this isn't coming out as clear as I would like, but I hope it is shedding some light.)
Alice is made freely available as a public service. |