액터의 위치를 지정된 FVector 값으로 변경한다.
FVector NewLocation = FVector(100.f, 200.f, 300.f);
MyActor->SetActorLocation(NewLocation);
false를 반환할 수도 있다. Sweep(충돌 감지) 옵션을 활성화하면 충돌을 고려한 이동이 가능하다.현재 액터의 위치를 FVector 형태로 반환한다.
FVector CurrentLocation = MyActor->GetActorLocation();
액터의 회전을 지정된 FRotator 값으로 변경한다.
FRotator NewRotation = FRotator(0.f, 90.f, 0.f); // Pitch, Yaw, Roll
MyActor->SetActorRotation(NewRotation);
현재 액터의 회전을 FRotator 형태로 반환한다.
FRotator CurrentRotation = MyActor->GetActorRotation();
액터의 스케일을 지정된 FVector 값으로 변경한다.
FVector NewScale = FVector(2.f, 2.f, 2.f); // X, Y, Z 방향으로 두 배
MyActor->SetActorScale3D(NewScale);
FVector 형태로 반환한다.FVector CurrentScale = MyActor->GetActorScale3D();
위치, 회전, 스케일을 포함한 전체 Transform을 한 번에 설정한다.
FVector NewLocation = FVector(100.f, 200.f, 300.f);
FRotator NewRotation = FRotator(0.f, 90.f, 0.f);
FVector NewScale = FVector(2.f, 2.f, 2.f);
FTransform NewTransform(NewRotation, NewLocation, NewScale);
MyActor->SetActorTransform(NewTransform);
FTransform은 위치, 회전, 스케일 값을 모두 포함하는 구조체다.현재 액터의 Transform(위치, 회전, 스케일)을 FTransform 형태로 반환한다.
FTransform CurrentTransform = MyActor->GetActorTransform();
현재 위치에서 지정된 벡터 값만큼 이동한다.
FVector DeltaLocation = FVector(50.f, 0.f, 0.f); // X 방향으로 50만큼 이동
MyActor->AddActorWorldOffset(DeltaLocation);
현재 회전에 지정된 FRotator 값만큼 추가로 회전한다.
FRotator DeltaRotation = FRotator(0.f, 45.f, 0.f); // Yaw 값 45도 증가
MyActor->AddActorWorldRotation(DeltaRotation);
부모 액터를 기준으로 상대적인 Transform을 설정한다. 월드 기준이 아니라 부모의 Transform에 따라 설정된다.
FVector RelativeLocation = FVector(50.f, 0.f, 0.f);
MyActor->SetActorRelativeLocation(RelativeLocation);
FRotator RelativeRotation = FRotator(0.f, 30.f, 0.f);
MyActor->SetActorRelativeRotation(RelativeRotation);
FVector RelativeScale = FVector(1.5f, 1.5f, 1.5f);
MyActor->SetActorRelativeScale3D(RelativeScale);