#include "OpenDoor.h" #include "GameFramework/Actor.h" // Sets default values for this component's properties UOpenDoor::UOpenDoor() { // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features // off to improve performance if you don't need them. PrimaryComponentTick.bCanEverTick = true; // ... } // Called when the game starts void UOpenDoor::BeginPlay() { Super::BeginPlay(); // 得到所在的Actor 设置这个Actor的属性 AActor* Actor = GetOwner(); //pitch:y yaw:z roll:x FRotator NewRotator = FRotator(0, 90, 0); Actor->SetActorRotation(NewRotator); } // Called every frame void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); // ... }
把们设置为可移动,这样就可以了