void exportTerrain::printTransformData(const MFnLight& theLight) { MStatus status; unsigned numParents = theLight.parentCount(&status); MObject transformNode; //will only use the first parent if(numParents != 0){ transformNode = theLight.parent(0,&status); // This node has no transform - i.e., it's the world node } else return; if (!status && status.statusCode () == MStatus::kInvalidParameter) return; MFnTransform transform(transformNode, &status); if (!status) { status.perror("MFnTransform constructor"); return; } fout << "Name: " << transform.name(&status) << endl; fout << "Transform: " << transform.translation( MSpace::kTransform,&status) << endl; MQuaternion rot; status = transform.getRotation(rot); double rotD[4]; rot.get(rotD); MColor tempRot(rotD[0],rotD[1],rotD[2],rotD[3]); // fout << "Rotation: " << tempRot << endl; printLightData(theLight); }
void UAimPredictionSC::addRotation(EAimCommand command, float value) { switch (command) { case EAimCommand::verticalAim: { FRotator tempRot(value, 0, 0); FQuat deltaQuat(tempRot); AddRelativeRotation(deltaQuat); } break; case EAimCommand::horizontalAim: { FRotator tempRot(0, value, 0); FQuat deltaQuat(tempRot); AddRelativeRotation(deltaQuat); } break; default: break; } }
// assumes dirY is normalized void fxRenderImage::faceDirection(Point3F & dirY) { // if we rotate about an axis, use a different routine... if (useRotationAxis) { faceDirection(dirY,rotationAxis); return; } Point3F dirX,dirZ; if (fabs(dirY.z) < 0.95) { // dirY is not near vector (0,0,1), so we can // use it as the pivot vector m_cross(dirY, Point3F(0,0,1), &dirX); dirX.normalize(); m_cross(dirX, dirY, &dirZ); } else { // dirY is near vector (0,0,1), so use // pivot Point3F(1,0,0) instead m_cross(Point3F(1,0,0), dirY, &dirZ); dirZ.normalize(); m_cross(dirY, dirZ, &dirX); } transform.setRow(0,dirX); transform.setRow(1,dirY); transform.setRow(2,dirZ); transform.flags |= TMat3F::Matrix_HasRotation; transform.flags &= ~TMat3F::Matrix_HasScale; if (useAxisSpin == true) { RMat3F tempRot(EulerF(0, axisSpin, 0)); TMat3F tempOutput; m_mul(tempRot, transform, &tempOutput); transform = tempOutput; } }