Animation-CobAnimation: Difference between revisions
Evil4Zerggin (talk | contribs) New page: ==Linear Units== Everything linear ''really'' happens in a unit I'll call Spring distance (sd). This is a tiny distance--there are 2^16 = 65536 sd in an elmo, which is the unit that is mo... |
Evil4Zerggin (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
==Pieces== | |||
Each unit will have a root piece, and then a tree of other pieces attached to the root piece. At the top of each file you'll need to put the following line: | |||
piece [names of pieces of the model separated by commas]; | |||
As usual, capitalization does not matter. You do not need to name every piece that the model actually has, although you should do so, and you cannot do anything to a piece that you have not named. If you try to do something to a piece that doesn't exist, Spring will throw an error. Generally it will not crash but you'll probably get lots of chat spam, so avoid this. | |||
Every piece starts in the position as it appears in any modeling program, such as Upspring. This is defined to be zero position and zero rotation. | |||
==Linear Units== | ==Linear Units== | ||
| Line 10: | Line 20: | ||
All COB animation statements specify an axis. There are three axes, "x-axis", "y-axis", and "z-axis". Positive x is to the unit's left (the right if you are looking at the unit from the front). Positive y is to the unit's top. Positive z is to the unit's front. | All COB animation statements specify an axis. There are three axes, "x-axis", "y-axis", and "z-axis". Positive x is to the unit's left (the right if you are looking at the unit from the front). Positive y is to the unit's top. Positive z is to the unit's front. | ||
The position and rotation of each piece defines the coordinate system for all of its child pieces. So, if you move or rotate a piece, all of its child pieces will move and rotate with it. | |||
==move== | |||
move [piece] to [axis] [distance] now; | |||
This moves the piece immediately. The piece will be in its new position before the next statement is executed. | |||
move [piece] to [axis] [distance] speed [speed]; | |||
This moves the piece at some speed until it reaches its destination, or the piece is told to move to a different distance along the same axis, whichever comes first. After this statement, the piece moves independent of the script; indeed, the script proceeds immediately to the next statement after it sets the piece moving. | |||
Speed is always positive, even if you are moving the piece to a negative distance. It is measured in Spring distance/second (sd/s). | |||
wait-for-move [piece] along [axis]; | |||
Makes the thread sleep until the piece stops moving. | |||
==turn== | ==turn== | ||
turn [piece] to [axis] now; | These are similar to movement in behavior, except they rotate the piece. | ||
turn [piece] to [axis] [angle] now; | |||
turn [piece] to [axis] [angle] speed [angular speed]; | |||
Pieces rotate around their __own__ center, not their parent's. If the piece moves, the center moves with it. A positive angle is counterclockwise looking at the piece from the positive end of the axis toward the negative end. Angular speed is always positive, even if the angle is negative. The speed is measured in Spring angles/second (sa/s). | |||
wait-for-turn [piece] around [axis]; | |||
==spin== | |||
spin [piece] around [axis] | |||
Revision as of 06:01, 28 May 2008
Pieces
Each unit will have a root piece, and then a tree of other pieces attached to the root piece. At the top of each file you'll need to put the following line:
piece [names of pieces of the model separated by commas];
As usual, capitalization does not matter. You do not need to name every piece that the model actually has, although you should do so, and you cannot do anything to a piece that you have not named. If you try to do something to a piece that doesn't exist, Spring will throw an error. Generally it will not crash but you'll probably get lots of chat spam, so avoid this.
Every piece starts in the position as it appears in any modeling program, such as Upspring. This is defined to be zero position and zero rotation.
Linear Units
Everything linear really happens in a unit I'll call Spring distance (sd). This is a tiny distance--there are 2^16 = 65536 sd in an elmo, which is the unit that is most commonly used. For example, weapon ranges are specified in elmos. Fortunately, Scriptor can automatically convert elmos to sd: just put the number of elmos you want in brackets. Sometimes you'll see scripts that use 2.5*2^16 = 163840 instead. I recommend not doing this since it makes conversion more difficult.
Angular Units
Likewise, everything angular really happens in a unit I'll call Spring angle (sa). There are 2^16 sa in a full circle. Generally you'll be working in degrees, and Scriptor can automatically convert from degrees to sa. There are 182 and 2/45 sa in a degree.
Axes
All COB animation statements specify an axis. There are three axes, "x-axis", "y-axis", and "z-axis". Positive x is to the unit's left (the right if you are looking at the unit from the front). Positive y is to the unit's top. Positive z is to the unit's front.
The position and rotation of each piece defines the coordinate system for all of its child pieces. So, if you move or rotate a piece, all of its child pieces will move and rotate with it.
move
move [piece] to [axis] [distance] now;
This moves the piece immediately. The piece will be in its new position before the next statement is executed.
move [piece] to [axis] [distance] speed [speed];
This moves the piece at some speed until it reaches its destination, or the piece is told to move to a different distance along the same axis, whichever comes first. After this statement, the piece moves independent of the script; indeed, the script proceeds immediately to the next statement after it sets the piece moving.
Speed is always positive, even if you are moving the piece to a negative distance. It is measured in Spring distance/second (sd/s).
wait-for-move [piece] along [axis];
Makes the thread sleep until the piece stops moving.
turn
These are similar to movement in behavior, except they rotate the piece.
turn [piece] to [axis] [angle] now;
turn [piece] to [axis] [angle] speed [angular speed];
Pieces rotate around their __own__ center, not their parent's. If the piece moves, the center moves with it. A positive angle is counterclockwise looking at the piece from the positive end of the axis toward the negative end. Angular speed is always positive, even if the angle is negative. The speed is measured in Spring angles/second (sa/s).
wait-for-turn [piece] around [axis];
spin
spin [piece] around [axis]