Vectors are entries that consist of three values called components. The position of an object in space is a vector since it consists out of the three components X, Y and Z. Since three values ( X, Y, Z ) mark a point in space, vectors are drawn like arrows and can be used to indicate direction and force. Also color is a vector channel because it is made out of three values for red, green and blue. A special form of a vector is a vector with four components - short vec4. Some color channels which have an additional alpha channel are such vectors ( R, G, B, A ). Vectors can not only be channels in Xpressionist but also defined variables or constants or the output of a function.
Implicit Position vector channels
Vector channels in EI are always implicit, while single floating point channels can either be implicit or explicit. That means, when you animate the position of an object set to implicit translation, only one keyframe is created containing all three values for X, Y and Z. In the Function Curve Editor of Animator you have the ability to control the velocity of the motion in between the keyframes but not the explicit X, Y and Z values (the components of the Position vector). It also means that the position vector channel gets lost when you switch an object from implicit to explicit - it will be converted to three single floating point channels.
When you examine the channels tab of Xpressionist you will find one Position channel if the position of the object is set to implicit. This is the default setting of Position channels in Animator.
...
Position
...
You can use the vector channel for simple look at statements:
Camera_1.Reference = Light_1.Position;
Since Camera_1.Reference is a vector channel and Light_1.Position is also a vector channel, Xpressionist assigns the X, Y and Z value of Light_1.Position to the X, Y and Z values of Camera_1.Reference:
The Camera will always look at the position of Light 1.
Single components of vectors and vector channels
What if you want to animate only the X value of the position of an object? Then you need to work with the X component of the position vector only. To do this you need to add the components name to the vector. Components of vectors and vector channels are always indicated by a dot and the component name that follows the channel name. Valid component names are X, Y and Z - R, G and B or H, S and V. The fourth component of a vector with four components (vec4) is always A.
Camera_1.Reference.X = Light_1.Position.X;
Now only the X component of the lights position vector will be assigned to the X component of the reference vector of the camera. The motion path of the Camera will only be altered in X - for Y and Z the implicit translation set in the world view windows will be used. When you now load the implicit position channel into the f-curve editor it will still show the velocity of the in between motion but only for Y and Z. The X value is now controlled by Xpressionist.
Explicit Position channels
When you switch the position channel of the light in the example in the light info window to explicit, you no longer have one vector channel but three separated floating point channels, which can be accessed individually - now you can change the X, Y and Z value because they are displayed as three different curves in the FCE.
When you have switched an object to explicit, the implicit vector channel described earlier vanishes from the Channel Selector within Xpressionist. Now the list reads:
...
XPosition
YPosition
ZPosition
...
There is no position vector channel anymore for the object but only the components of the former vector left as three discreet single floating point channels. Since you sometimes may want to create a look at statement as in the above example to look at an object that has an explicit translation, you would have to assign each position channel to the components of the Cameras reference vector channel individually:
Camera_1.Reference.X = Light_1.XPosition;
Camera_1.Reference.Y = Light_1.YPosition;
Camera_1.Reference.Z = Light_1.ZPosition;
With this you assign the explicit position channels of the light to each component of the implicit Camera reference vector individually.
Virtual Channels
You can switch Xpressionsit to Virtual Channel Mode in the Global Options in the Preferences Tab. This will combine explicit position channels to one position vector channel. If you use this option it is irrelevant if a channel is switched to implicit or explicit in Animator. The channel will always read "Position" within Xpressionist. The virtual Position channel will always be a vector channel and contain X, Y and Z values.
Defining vectors
You can define a vector in Xpressionist with the following syntax:
vec( component1, component2, component3 )
You can assign such a vector to a vector channel:
Camera_1.Reference = vec( 4, 5, 90 );
The statement
Restposition = vec( 4, 5, 90 );
defines "Restposition" as a vector constant with the components 4, 5 and 90. You can now use "Restposition" in an expression with an implicit vector channel e.g.
Restposition = vec( 4, 5, 90 );
Camera_1.Reference = Restposition;
Now XP will set the Reference of Camera 1 to X = 4, Y = 5 and Z = 90. You can also define a vector with custom or system variables:
Light_position_vector = vec( Light1.XPosition, Light1.YPosition, Light1.ZPosition )
You can now write an expression like this:
Light_position_vector = vec( Light1.XPosition, Light1.YPosition, Light1.ZPosition )
Camera1.Reference = Light_position_vector;
Again the camera will always look at the lights position, even though the light is set to explicit velocity and the camera is set to implicit velocity.
Defining a vector with four components
To define a vector with 4 components use this:
color = vec4( R component, G component, B component, A component )
The fourth component of a vec4 is always indexed with a dot A
fourth_component = color.A;
Vector math
Vectors are special when you do the math with them. You can do arithmetic operations, relational operations and logical operations with vectors. There are also some functions that can be used with vectors. Read about operators here. Read about functions here.
|