Hello all!
I am learning UE4 and is exploring the c++ part of the engine. Currently I’m following the C++ Battery Collector series from UE
(https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gYup-gvJtMsgJqnEB_dGiM4/mSRov77hNR4/index.html)
and I’m on part 10 of the series. When I play around with the scene, I discovered this weird behavior between my character and the small batteries as recorded here - YouTube (I tried with larger battery and it behave normally). I’ve been searching around for a way to fix it but no luck. I would like to know if there is away to fix it. Any help is appreciated!
Code for the Pickup.cpp class
// Fill out your copyright notice in the Description page of Project Settings.
#include "BatteryCollector.h"
#include "Pickup.h"
// Sets default values
APickup::APickup()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
// All pickups start active
bIsActive = true;
// Create the static mesh component
PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("PickupMesh"));
RootComponent = PickupMesh;
}
// Called when the game starts or when spawned
void APickup::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void APickup::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
bool APickup::IsActive() {
return bIsActive;
}
void APickup::SetActive(bool PickupState) {
bIsActive = PickupState;
}
void APickup::IsCollected_Implementation(){
// Log a debug message
FString PickupDebugString = GetName();
UE_LOG(LogClass, Log, TEXT("You have collected %s"), *PickupDebugString);
}