Prepared player camera setup for animation
Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
parent
a1c4f3725c
commit
8d2fe05e83
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/BP_Player.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Player.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Weapon/Ammo/BP_Tracer.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Weapon/Ammo/BP_Tracer.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Weapon/Ammo/FXE_ShotGun_Trail.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Weapon/VFX/ProjectileHit/NS_ProjectileHit.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Weapon/VFX/ProjectileHit/NS_ProjectileHit.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:00552f5c9ac368a603670e87a704df5ad1114f35d30cc20694e6cb766fb2e8f3
|
oid sha256:82f689c996d185b6a7b87026be21593479634e4119b31638a640b5bda185d576
|
||||||
size 65622016
|
size 65548288
|
||||||
|
@ -13,21 +13,19 @@
|
|||||||
|
|
||||||
ALMPlayer::ALMPlayer()
|
ALMPlayer::ALMPlayer()
|
||||||
{
|
{
|
||||||
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
|
||||||
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
// Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
||||||
Camera->SetupAttachment(RootComponent);
|
// Camera->SetupAttachment(RootComponent);
|
||||||
Camera->bUsePawnControlRotation = true;
|
// Camera->bUsePawnControlRotation = true;
|
||||||
Camera->SetRelativeLocation(FVector(20, 0, 90));
|
// Camera->SetRelativeLocation(FVector(20, 0, 90));
|
||||||
|
//
|
||||||
ArmsMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Arms Mesh"));
|
// ArmsMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Arms Mesh"));
|
||||||
ArmsMesh->SetupAttachment(Camera);
|
// ArmsMesh->SetupAttachment(Camera);
|
||||||
|
|
||||||
SpreadStream = FRandomStream(FMath::Rand());
|
SpreadStream = FRandomStream(FMath::Rand());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
|
||||||
void ALMPlayer::BeginPlay()
|
void ALMPlayer::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
@ -71,7 +69,7 @@ void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WeaponManager = Manager;
|
WeaponManager = Manager;
|
||||||
WeaponManager->Initialize(ArmsMesh);
|
WeaponManager->Initialize(GetArms());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALMPlayer::PlayAnimation(UAnimMontage* Animation)
|
void ALMPlayer::PlayAnimation(UAnimMontage* Animation)
|
||||||
@ -122,15 +120,31 @@ void ALMPlayer::FireBullets(const FLMBulletInfo Settings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector ALMPlayer::GetWeaponFiringOrigin() const
|
FVector ALMPlayer::GetWeaponFiringOrigin()
|
||||||
{
|
{
|
||||||
if (!Camera)
|
if (!GetCam())
|
||||||
{
|
{
|
||||||
GEngine->AddOnScreenDebugMessage(INDEX_NONE, 10.f, FColor::Silver, TEXT("No camera ???"));
|
GEngine->AddOnScreenDebugMessage(INDEX_NONE, 10.f, FColor::Silver, TEXT("No camera ???"));
|
||||||
return FVector::ZeroVector;
|
return FVector::ZeroVector;
|
||||||
}
|
}
|
||||||
return Camera->GetComponentTransform().GetLocation();
|
return GetCam()->GetComponentTransform().GetLocation();
|
||||||
}
|
}
|
||||||
FVector ALMPlayer::GetAimVector() const { return Camera->GetForwardVector(); }
|
|
||||||
|
|
||||||
|
FVector ALMPlayer::GetAimVector() { return GetCam()->GetForwardVector(); }
|
||||||
|
|
||||||
|
UCameraComponent* ALMPlayer::GetCam()
|
||||||
|
{
|
||||||
|
if (!Camera)
|
||||||
|
Camera = GetCamera();
|
||||||
|
|
||||||
|
return Camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
USkeletalMeshComponent* ALMPlayer::GetArms()
|
||||||
|
{
|
||||||
|
if (!ArmsMesh)
|
||||||
|
ArmsMesh = GetArmsBP();
|
||||||
|
|
||||||
|
return ArmsMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -60,10 +60,10 @@ public:
|
|||||||
void FireBullets(const FLMBulletInfo Settings);
|
void FireBullets(const FLMBulletInfo Settings);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
FVector GetWeaponFiringOrigin() const;
|
FVector GetWeaponFiringOrigin();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
FVector GetAimVector() const;
|
FVector GetAimVector();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
||||||
void WeaponFired();
|
void WeaponFired();
|
||||||
@ -83,6 +83,15 @@ public:
|
|||||||
UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
|
UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
|
||||||
void OnReload();
|
void OnReload();
|
||||||
|
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
|
UCameraComponent* GetCamera();
|
||||||
|
UCameraComponent* GetCam();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
|
USkeletalMeshComponent* GetArmsBP();
|
||||||
|
USkeletalMeshComponent* GetArms();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
||||||
TObjectPtr<ULMWeaponManager> WeaponManager;
|
TObjectPtr<ULMWeaponManager> WeaponManager;
|
||||||
|
Reference in New Issue
Block a user