发布时间:2023-02-28 16:30
eg:在角色Character中创建一个Mesh,蓝图(以代码为父类)中放具体模型
Character.h
UPROPERTY(Category="Character",VisibleAnywhere,BlueprintReadOnly)
class USkeletalMeshComponent* Mesh1P; //声明一个Mesh的SkeletalMeshComponent
Character.cpp
构造函数中写
Mesh1P = CreateDefaultSubobject(TEXT("CharacterMesh1P"));
//Mesh1P->SetOnlyOwnerSee(true);
//Mesh1P->SetupAttachment(FirstPersonCameraComponent);
//Mesh1P->bCastDynamicShadow = false;
//Mesh1P->CastShadow = false;
//Mesh1P->RelativeRotation = FRotator(1.9f, -19.19f, 5.2f);
//Mesh1P->RelativeLocation = FVector(-0.5f, -4.4f, -155.7f);
教程中在构造函数中还写了
用于将蓝图作为默认角色 不过现在好像修改了 不用写这一段了