DoShiftSpin
The Syntax is:
DoShiftSpin;
If you haven't already read it, you might like to look at the discussion of the DoShift Command before continuing. When several actors must be moved simultaneously, intercalating their motions in a script using the SpinShift, ShiftSpin, Spin, and Shift commands is a simple method to use. But when many individual calls are needed for a very smooth motion, it can be a bit slow. An alternative for continuous motion called DoShiftSpin is available that will in general be faster.
Suppose, for example, that you wanted to ShiftSpin some actors simultaneously along their trajectories given by differential equations, or by curves, or even stochastically. You could create the trajectories as an anonymous (and invisible) actor. If you wanted the orientation to change, as well as the position, for example, in rotating and orbiting a planet, you would create an invisible actor with the sequence of pairs of orientations and positions, in that order, and use either DoSpinShift or DoShiftSpin.
For ShiftSpins, we need a type of invisible anonymous actor which is a sequence of pairs: Quaternion(), Vertex() (or (Vertex4(), Vertex3())) in that order. The arguments to Quaternion() or Vertex4() will always be interpreted as spins, and the arguments to the Vertex() (or Vertex3() ) will always be interpreted as shifts. This is the order we use: Vertex4(), Vertex3(), Vertex4(), Vertex3(), ..., Vertex4(), Vertex3(), that is: Spin, Shift, Spin, Shift, Spin, Shift, ... Spin, Shift when defining the invisible actor whether we use DoSpinShift or DoShiftSpin.
The queue works this way. Suppose it contains the ordered list of actors: {a1, a2, .., aN}. Then when DoShiftSpin is called, tha actor a1 is shifted by the first vertex3, then spun by the previous Quaternion, then a2 shifted by the second vertex3, then spun by the previous Quaternion, a3 shifted by the third vertex3, then spun by the previous Quaternion, ..., aN is shifted by the nth vertex3, then spun by the previous Quaternion, then a1 is shifted by the (n+1) vertex3, then spun by the previous Quaternion, and so on cyclically, until there are no more quaternion/vertex pairs.
It is always Quaternion() = Spin first, then Vertex() = Shift second, whether we use a SpinShift or a ShiftSpin. And, of course, the pairs: Quaternion(), Vertex() are now used for each actor in the Queue. This means that the script must anticipate in the Gldraw{...} statement just how many actors will be in the queue in order to intercalate the motions correctly. Usually, this is easy to do, even at run time.
In all other respects (given the opposite order of operations) DoShiftSpin is like DoSpinShift.
The order of operations, then, is:
Gldraw {
....
}
Push;
DoShiftSpin;
See Also