Hi everyone. I’m just trying to fire an event when my sphere is overlaping. But AddDynamic is failing and I don’t know how to make it works. These are my .cpp and .h
Thanks in advance.
Everything looks fine, try adding DestroySphereComp->SetGenerateOverlapEvents(true);
And in your header also declare UStaticMeshComponent;
It doesn’t work SolidGasStudios. AddDynamic is still throwing an error. I don’t get it.
Move AddDynamic into BeginPlay()
It doesn’t work either, I can’t compile it without errors.
What are the errors?
If it is specifically AddDynamic giving compile errors you can use this instead:
FScriptDelegate CollisionEndOverlap;
CollisionEndOverlap.BindUFunction(this, TEXT(“OnExitCollision”));
Component->OnComponentEndOverlap.Add(CollisionEndOverlap);
In your header remove ‘virtual’ from BeginPlay and Tick
also declare UStaticMeshComponent like you did USphereComponent if you haven’t already.
FScriptDelegate CollisionEndOverlap;
CollisionEndOverlap.BindUFunction(this, TEXT(“OnExitCollision”));
Component->OnComponentEndOverlap.Add(CollisionEndOverlap);
This works. Thanks!
Class is ABlackHole, but in AddDynamic you wrote &BlackHole::OnOverlapBegin. (missing ‘A’ in front)
■■■■ IT. You’re totally right. Thanks man. It seems to work now.