public override MMatrix asMatrix() { // Get the current transform matrix MMatrix m = base.asMatrix(); // Initialize the new matrix we will calculate MTransformationMatrix tm = new MTransformationMatrix( m ); // Find the current rotation as a quaternion MQuaternion quat = rotation(); // Convert the rocking value in degrees to radians DegreeRadianConverter conv = new DegreeRadianConverter(); double newTheta = conv.degreesToRadians( getRockInX() ); quat.setToXAxis( newTheta ); // Apply the rocking rotation to the existing rotation tm.addRotationQuaternion( quat.x, quat.y, quat.z, quat.w, MSpace.Space.kTransform); // Let Maya know what the matrix should be return tm.asMatrixProperty; }
public override MMatrix asMatrix() { // Get the current transform matrix MMatrix m = base.asMatrix(); // Initialize the new matrix we will calculate MTransformationMatrix tm = new MTransformationMatrix(m); // Find the current rotation as a quaternion MQuaternion quat = rotation(); // Convert the rocking value in degrees to radians DegreeRadianConverter conv = new DegreeRadianConverter(); double newTheta = conv.degreesToRadians(getRockInX()); quat.setToXAxis(newTheta); // Apply the rocking rotation to the existing rotation tm.addRotationQuaternion(quat.x, quat.y, quat.z, quat.w, MSpace.Space.kTransform); // Let Maya know what the matrix should be return(tm.asMatrixProperty); }