7274人加入学习
(30人评价)
Unreal入门第一季 - 虚幻C++基础训练

制作完成于2019.8.27,基于Unreal 4.22

价格 免费

502

1.在头文件中声明一个摄像机组件:

public:

UPROPERTY(VisibleAnywhere,Category="My Pawn Components")

//class告诉编译器不要对下面的声明提示报错,后面会进行声明

class UCameraComponent* MyCamera;

2.在源文件中包含头文件:

#include "Camera/UCameraComponent.h"

3.在源文件中初始化:

MyCamera=CreateDefaultSubobject<UCameraComponent>(TEXT("MyCamera"));

MyCamera->SetupAttachment(this->GetRootComponent());

MyCamera->SetRelativeLocation(FVector(-300.0f,0.0f,300.0f));

MyCamera->SetRelativeRotation(FRotator(-45.0f,0.0f,0.0f));

4.创建蓝图类BP_MyPawn继承自定义C++类MyPawn

5.在蓝图类中添加网格体模型并赋予材质

[展开全文]