@Zakwayda Cool, just right in time, haha!
I was just testing all 6 possible combinations of the quaternion multiplications but every single one failed in the results.
void SpawnSMActor(const TCHAR *path,float sX,float sY,float sZ,float rX,float rY,float rZ,float pX,float pY,float pZ)
{
// Transform
FVector Scale(sX, sY, sZ); // Scale
FVector Position; // Translation
// ************************************************************************************
// Conversion XSI Coordinate System to UE4 Coordinate System
// Position Swap the Z and Y Coordinates
Position.X = pX * 100; // TX
Position.Y = pZ * 100; // TZ
Position.Z = pY * 100; // TY
// Quaternions
FQuat qx(1, 0, 0, -rX);
FQuat qz(0, 0, 1, -rY);
FQuat qy(0, 1, 0, -rZ);
//FQuat qu = qy * qz * qx; // Nope 3.37 , 90 , 5.35
FQuat qu = qy * qx * qz; // Nope 32.52 , 90 , 34.50
//FQuat qu = qx * qy * qz; // Nope 24.58 , 90 , 26.56
//FQuat qu = qx * qz * qy; // Nope 32.3 , 90 , 34.5
//FQuat qu = qz * qx * qy; // Nope 6.67 , 90 , 8.88
//FQuat qu = qz * qy * qx; // Nope 17.56 , 90 , 19.76
FRotator Rotation(qu);
FTransform Transform(Rotation, Position, Scale);
// ************************************************************************************
// Load Static Mesh from given Reference Path from UE4 Explorer
UStaticMesh* StaMesh = LoadObject<UStaticMesh>(nullptr, path);
// Creating the Actor and Positioning it in the World based on the Static Mesh
UWorld* currentWorld = GEditor->GetEditorWorldContext().World();
ULevel* currentLevel = currentWorld->GetCurrentLevel();
UClass* StaticMeshClass = AStaticMeshActor::StaticClass();
AActor* NewActorCreated = GEditor->AddActor(currentLevel, StaticMeshClass, Transform, true, RF_Public | RF_Standalone | RF_Transactional);
AStaticMeshActor* smActor = Cast<AStaticMeshActor>(NewActorCreated);
smActor->GetStaticMeshComponent()->SetStaticMesh(StaMesh);
smActor->SetActorScale3D(Scale);
// ID Name & Visible Name
//smActor->Rename(TEXT("MyStaticMeshInTheWorld"));
//smActor->SetActorLabel("MyStaticMeshInTheWorld");
GEditor->EditorUpdateComponents();
smActor->GetStaticMeshComponent()->RegisterComponentWithWorld(currentWorld);
currentWorld->UpdateWorldComponents(true, false);
smActor->RerunConstructionScripts();
GLevelEditorModeTools().MapChangeNotify();
}
I will check out the new instructions