Ok, so it might be this: since your enemy has a “blocking” collision (vs the overlap) what’s triggered it’s for sure an hit event, but not sure anymore the overlap gets triggered too (since your enemy block the projectile before it can actually overlap). As a test, try to use OnActorHit (if testing against the whole actor, is in your current implementation) or onComponentHit. Make sure you check also “Simulation Generates Hit Event” in the collision settings for both actors.
If that works you’ll at least have a hint to why you got your problems, which is a good first step to solve them if you still really need to test against an overlap.
Greetings,
I am working on making a really simple magic type attack where the character launches a spell. The issue I am encountering is when I try to use the overlap functions in c++ or some setting in UE4 that is causing no overlap events to be generated. When the spell overlaps ‘enemy’ it should print that event to screen, but nothing happens. Both actors have generate overlap events set to true, so my only guess is that its a setting in UE4 I have yet to understand. I attached photos of the overlap event code from the spell class, and the collision settings for both the spell and enemy. Any help appreciated and I’ll answer what I can. I thank you for your time.
Troubleshoot help - Album on Imgur - Link to photos
Hi TheSuperPixal,
the first thing that gets to the eye looking at your code is that you are not defining nor attaching the projectile mesh to the collision sphere; this might or might not be the cause of your problem, depending on how you’ve structured the rest of your code. Basically this is missing:
Mesh = CreateDefaultSubObject<UStaticMeshComponent>(TEXT("ProjectileMesh"));
Mesh->SetupAttachment(CollisionVolume);
Hope that helps!
f
Thank you for the reply,
I added what you recommended but it did not seem to change anything. The way I structured the code in this case is that there is a parent class called “BaseMagic” which is an actor class, then the “MFireBall” class is a child of “BaseMagic”. If there is anything else I could post that might help let me know, I could also push everything to a github if that is needed. It feels like I’m missing something simple but I just can’t figure out what.
Thanks,