Nuke - Matrix4 Camera Lock Z Rotation
So, I'm creating a plugin in Nuke (from The Foundry) that will mimic the animation constraint behavior of Maya. I have a parent, child and then parameters for point orientation, orientation, target, parent. This all works very well, however the biggest problem at the moment is the limitation of the Aim.
Some prerequisites: Working with Nuke class Matrix4 It is worth noting that this matrix is a 4x4 in which the first three columns of the first three rows refer to rotations / scale and the last column of the first three rows is the translation (X, Y, Z)
into the Vector3 classes I get the source and target position. Target Source = ST Then im setting the Y plane (one inverted, one not) Then I get the product of the corsa of my ST point and the Y plane, and then another cross product of my ST and the inverted Y plane. (When parent after child flips it) Then I getting the cross product of my ST and the result of my ST.cross (y_plane)
The target constraint does work well enough, but I get a lot of Z rotation in my camera (child) when the parent is at certain positions. I want to avoid this Z turn. Will anyone know how to do this?
source to share
If you're emulating Maya's constraint system, Maya handles the Z rotation through up vector
, which adjusts the Z rotation to align with one of five options:
-
scene up
aims the top of your camera at+Y
-
object up
directs the top of your camera towards the third object. -
object rotation up
corresponds to the rotation of the camera Z to the rotation of theXYZ
third object -
vector
aims the top of your camera at this vector -
none
Doesn't try to orient the top of your camera with anything. This should be what you have.
In addition, there is up vector
one that defines what the "top of your camera" is, as well as aim vector
defines where the camera should point.
source to share