과제03 필수 구현 기능
1. 퍼즐 오브젝트 설계
2. 서로다른 Actor클래스 2개 이상 구현(이동/회전)
3. Tick 함수 기반 동적 Transfor(회전 / 왕복운동)
if (!FMath::IsNearlyZero(RotationSpeed))
{
AddActorLocalRotation(FRotator(0.0f, RotationSpeed*DeltaTime, 0.0f));
}
FVector CurrentLocation = GetActorLocation();
float Direction = bMovingForward ? 1.0f : -1.0f;
FVector NewLocation = CurrentLocation + FVector(MoveSpeed * Direction * DeltaTime, 0.0f, 0.0f);
SetActorLocation(NewLocation);
float Offset = NewLocation.X - StartLocation.X;
if (Offset >= MaxRange)
{
bMovingForward = false;
}
else if (Offset <= -MaxRange)
{
bMovingForward = true;
}
4. 리플렉션 적용
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SpinObj|Components")
USceneComponent* SceneRoot;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SpinObj|Components")
UStaticMeshComponent* StaticMeshComp;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SpinObj|Properties")
float RotationSpeed = 90.0f;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "MoveObj|Components")
USceneComponent* SceneRoot;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MoveObj|Components")
UStaticMeshComponent* StaticMeshComp;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MoveObj|Properties")
float MoveSpeed = 200.0f;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MoveObj|Properties")
float MaxRange = 300.0f;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "MoveObj|Properties")
FVector StartLocation;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "MoveObj|Properties")
bool bMovingForward = true;
5. 오브젝트 배치 및 테스트