Hi all, I had build a MatineeActor animation, which binded a airplane(static mesh actor). sometimes i need another airplane follow the matineeActor animation, I write c++ code like this:
AActor* tempActor = PlayerController->PlayerCameraManager->GetViewTarget();
if (tempActor)
{
FRotator rotator = tempActor->GetActorRotation();
const FQuat RelativeRotQuat = rotator.Quaternion();
const FQuat DeltaRotQuat = rot.Quaternion();
const FQuat NewRelRotQuat = RelativeRotQuat * DeltaRotQuat;
tempActor->SetActorRotation(NewRelRotQuat.Rotator());
TActorIterator<AStaticMeshActor> ActorItr = TActorIterator< AStaticMeshActor >(GetWorld());
while (ActorItr)
{
FString name = ActorItr->GetName();
if (name == "SM_Hang_Glider_2" || name == "SM_Hang_Glider_4")
{
OutputDebugString(*name);
ActorItr->SetActorRotation(rotator);
FVector location = tempActor->GetActorLocation();
ActorItr->SetActorLocation(location, true);
OutputDebugString(*location.ToString());
}
++ActorItr;
}
}
“tempActor” is the airplane binding on matineeactor, “SM_Hang_Glider_2” is another airplane’s name in editor, and “SM_Hang_Glider_4” is ID NAME of the airplane(i don’t know why the name and the ID NAME not the same, and i don’t know which i need to use, so i write a “or” Expression).
In my code, i found the “SetActorLocation” don’t work? i can not get what i need. The second airplane could not see while i play the matinee animation. how i can deal with this? this code is run on actor tick event. and the “tempActor” 's location output is corret.
thankyou a lot!
sorry for my poor english.