I have been working on a retro fps and have been setting up the grenade explosion in blueprinting (player throws a dynamite bundle).
The actor is a child component of the player character blueprint, everything is set up within the player BP (since I am not planning any kind of multiplayer its purely singleplayer). My question is, I have set the sphere component on the child actor to increase size till 500uu and that works.
And it spawns correctly as well, now I am trying to use on collision overlap but I cannot figure out how to use the increasing sphere collision component to cause damage since that sphere collision component is from the child actor. Here is what I have set up for collision overlap detection so far:
If anyone has any suggestions that would be wonderful, everything I’ve been researching and trying out hasn’t worked at all yet, and my pistol/shotgun run off of line traces. My melee enemy character has the collision component attached to itself in its own blueprint so I was trying that method but to no avail. Thank you for all your help! The solve is probably quite simple, if more information is needed just let me know! Thanks!
Here, are you inside the Character actor calling the OnComponentBeginOverlap? Maybe that is the problem, since the component is a child actor and not a sphere component directly.
What actor are you using as a ChildActor here? you could have a class AMyGrenade and set that as the child actor here (I’m not sure if the child is actually the grenade). Then, you should call that OnComponentBeginOverlap inside the AMyGrenade class, so you know you are receiving the overlap event from the explosion sphere. If you decide to go this way, then the code that handles the explision should also be inside the AMyGrenade class.
With this, you should be getting the event correctly. After this you only need to choose a way to handle this event. You could have the AMyGrenade class cause the damage directly. Do this by setting the Character as the Owner actor when you spawn the grenade, so you can pass the player as the WhoIsCausingDamage variable for HitEnemy function.
You can also have the grenade call a function in the player to cause the damage. That is your choice really.
Hope this helps. If this didn’t answer your question please elaborate
Thank you! I was unaware that it could communicate between the two actors but I forgot I had a cast to the dynamite actor in my BP already so it was fairly easy to hook up.