//------------------------------------------------------------------------- // //------------------------------------------------------------------------- FVector FFbxDataConverter::ConvertRotationToFVect(FbxQuaternion Quaternion, bool bInvertOrient) { FQuat UnrealQuaternion = ConvertRotToQuat(Quaternion); FVector Euler; Euler = UnrealQuaternion.Euler(); if (bInvertOrient) { Euler.Y = -Euler.Y; Euler.Z = 180.f+Euler.Z; } return Euler; }
void ASmrActor::PoseCharacterWorldSpace(UPoseableMeshComponent* mesh) { //Get skeleton and apply correct settings skeleton = m_motion.getSkeleton(m_frameIndex); skeleton.setRotationOrder(TRANSLATIONFIRST); skeleton.setMode(SMRModeType::ABSOLUTEMODE); //Apply rotation to each bone in the Unreal skeleton for (uint32 i = 0; i < skeleton.getNumJoints(); ++i) { FQuat orientation = USmrFunctions::RightCoordToLeft(USmrFunctions::MakeFQuat(skeleton.getJoint(i)->getOrientation())); FVector euler = orientation.Euler(); FRotator rotator = FRotator::MakeFromEuler(euler); //Rotations are applied to bones with identical names so the skeletons must match exactly mesh->SetBoneRotationByName(FName(skeleton.getJoint(i)->getName().c_str()), rotator, EBoneSpaces::WorldSpace); } }