这个是我看着教程做的。我已经设置了移动和镜头转向,GameModeBase里面也指认了Character.但是一按播放,人物只会出现在地图中间,控制不了。就好像是一个空的模板一样,可以移动跳跃,但是人物控制不了
这是在Character.h文件
[mw_shl_code=applescript,true]//添加人物
UPROPERTY(Category = Character,VisibleAnywhere,BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class USkeletalMeshComponent* Mesh1P;[/mw_shl_code]
这是Character.cpp文件
[mw_shl_code=applescript,true]//添加人物
Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
[/mw_shl_code]
GameMode.Cpp文件
[mw_shl_code=applescript,true]#include "RPGBeginGameModeBase.h"#include "OneCharacter.h"
#include "ConstructorHelpers.h"
ARPGBeginGameModeBase::ARPGBeginGameModeBase()
{
//DefaultPawnClass = AOneCharacter::StaticClass();
static ConstructorHelpers::FObjectFinder<UBlueprint> PlayerPawnObject(TEXT("Blueprint'/Game/BP_OneCharacter.BP_OneCharacter'"));
if (PlayerPawnObject.Object != NULL)
{
DefaultPawnClass = (UClass*)PlayerPawnObject.Object->GeneratedClass;
}
}
[/mw_shl_code]
|