当前位置:网站首页>U++ UE4官方文档课后作业
U++ UE4官方文档课后作业
2022-08-05 06:50:00 【是秃头的兔子呀】
.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "RotationAroundAc.generated.h"
UCLASS()
class FLOATINGCUBE_API ARotationAroundAc : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ARotationAroundAc();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* Child1;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* Father;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class USpringArmComponent* CameraSpring;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int ZRotation;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int ZoomRotation;
UFUNCTION(BlueprintCallable)
void DestroyMyself();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float destroyTime;
};
.cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "RotationAroundAc.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "GameFramework/Actor.h"
#include "CoreMinimal.h"
#include "Engine.h"
// Sets default values
ARotationAroundAc::ARotationAroundAc()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Father = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("FatherAc"));
CameraSpring = CreateDefaultSubobject<USpringArmComponent>(TEXT("Spring"));
RootComponent = Father;
CameraSpring->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 0.0f), FRotator(-60.0f, 0.0f, 0.0f));
Child1 = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Child1"));
Child1->SetupAttachment(CameraSpring, USpringArmComponent::SocketName);
Child1->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 0.0f), FRotator(0.0f, 0.0f, 0.0f));
CameraSpring->TargetArmLength = 50.0f;
CameraSpring->bEnableCameraLag = true;
CameraSpring->CameraLagSpeed = 3.0f;
CameraSpring->SetupAttachment(Father);
ZRotation = 0;
ZoomRotation = 10;
destroyTime = 10.0f;
}
void ARotationAroundAc::DestroyMyself() {
Child1->DestroyComponent();
return;
}
// Called when the game starts or when spawned
void ARotationAroundAc::BeginPlay()
{
Super::BeginPlay();
FTimerHandle TimeHandle;
GetWorld()->GetTimerManager().SetTimer(TimeHandle, this, &ARotationAroundAc::DestroyMyself, destroyTime, true);
}
// Called every frame
void ARotationAroundAc::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
ZRotation += ZoomRotation;
CameraSpring->SetWorldRotation(FRotator(0.0f, ZRotation, 40.0f));
}
边栏推荐
- Hong Kong International Jewellery Show and Hong Kong International Diamond, Gem and Pearl Show kick off
- TCP的粘包拆包问题+解决方案
- binary search tree problem
- 2022 Fusion Welding and Thermal Cutting Operation Certificate Exam Questions and Mock Exams
- 2022.7.29好题选讲(计数专题)
- protobuf is compiled against the associated .proto file
- Flink学习11:flink程序并行度
- Summary of Text Characterization Methods
- 17-VMware Horizon 2203 虚拟桌面-Win10 手动桌面池浮动(十七)
- Hash these knowledge you should also know
猜你喜欢
随机推荐
protobuf is compiled against the associated .proto file
AI + video technology helps to ensure campus security, how to build a campus intelligent security platform?
Libpq 是否支持读写分离配置
TRACE32——SMP多核调试
UDP组(多)播
任务流调度工具AirFlow,,220804,,
[Tool Configuration] Summary of Common Uses of VSCode
binary search tree problem
[Shanghai] Hiring .Net Senior Software Engineer & BI Data Warehouse Engineer (Urgent)
In the anaconda Promat interface, import torch is passed, and the error is reported in the jupyter notebook (only provide ideas and understanding!)
Falsely bamboo brother today and found a localization of API to use tools
MySQL: JDBC programming
蓝牙gap协议
开启防火墙iptable规则后,系统网络变慢
Hash these knowledge you should also know
"Automatic Data Collection Based on R Language"--Chapter 3 XML and JSON
UDP group (multi)cast
Japan Sanitary Equipment Industry Association: Japan's warm water shower toilet seat shipments reached 100 million sets
Shiny04---DT和进度条在shiny中的应用
Shared memory + inotify mechanism to achieve multi-process low-latency data sharing









