Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuke - Matrix4 camera constraint lock Z rotation

So im building a plugin in Nuke (from The Foundry) that will mimic Maya's animation constraint behaviours. I have a parent, a child, and then options for point, orientation, aim, parent constraints. This is all working pretty well, however my biggest issue at the moment is the Aim constraint.

Some background: Working with the Nuke Matrix4 class Its worth noting this matrix is a 4x4 in which the first 3 columns of the first 3 rows apply to rotations/scale, and the last column of the first 3 rows is translation (X,Y,Z)

in Vector3 classes I am getting the source and target position. Target-source = ST Then im setting up a Y plane (one inverted, one not) Then i get the corss product of my ST point and the Y plane, and then another cross product of my ST and inverted Y plane. (for when the parent is behind the child to invert it) I then get the cross product of my ST and the result of my ST.cross(y_plane)

The aim constraint actually works quite well, but i get a lot of Z rotation in my camera (child) when the parent is in certain postions. I want to be able to avoid this Z rotation. Would anyone happen to know how to do so?

like image 427
Alex Avatar asked Dec 15 '25 12:12

Alex


1 Answers

If you're emulating Maya's constraint system, Maya handles Z rotation through the up vector, which adjusts your Z rotation to align with one of five options:

  • scene up aims the top of your camera to +Y
  • object up aims the top of your camera toward a third object
  • object rotation up matches the camera's Z rotation to the XYZ rotation of a third object
  • vector aims the top of your camera at that vector
  • none Doesn't attempt to orient the top of your camera with anything. This must be what you have currently.

Additionally, there's an up vector which defines what is the "top of your camera" just like the aim vector defines where the camera should point.

like image 195
mhlester Avatar answered Dec 17 '25 02:12

mhlester