Hello I’ve been trying to create a invisible sphere radius collision around an actor/collectible that updates each frame pulsating in and out every tick and expanding if the player gets near. I’m a beginner to scripting in unreal and don’t necessarily understand how to do this, if you have suggestions for cleaning this mess up please let me know. Thanks for reading any help would be appreciated.
`#include “Gut.h”
#include “Components/PointLightComponent.h”
#include “Components/SphereComponent.h”
#include “DrawDebugHelpers.h”
// Sets default values
AGut::AGut()
{
GutSphereInflate = 300.0f;
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don’t need it.
PrimaryActorTick.bCanEverTick = true;
// Create GutMesh/Organ Ball Mesh future and then set it as core, exposed text in subsequent lines
GutMesh = CreateDefaultSubobject(TEXT(“GutCore”));
RootComponent = GutMesh;
// Create GutSphere as a sub component and give it radius
GutSphere = CreateDefaultSubobject(TEXT(“UsphereGut”));
// GutSphere coll give
GutSphere->SetCollisionProfileName(TEXT(“TriggerGutPop1”));
GutSphere->SetupAttachment(RootComponent);
}
// Called when the game starts or when spawned
void AGut::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AGut::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
GutSphere->SetSphereRadius(GutSphereInflate);
}
//Custom Implementation here FUTURE FUNCTIONS
void AGut::PopGutCollect()
{
}
void AGut::GutPulsate()
{
}
void AGut::RadiusExpandDynamic()
{
}
`