Does on Component Begin Overlap Call Continuously
I found many threads on this subject but they were outdated and the suggested solutions didn't cover what was actually the issue for me so I wanted to make something here to post my solution in hopes it helps others in the future. Embarrassing to share because of how simple it is but I know this drives a lot of people nuts and will save many tortured souls.
First I'll say, when you're a hobbyist game dev and you're not able to spend a lot of time every day on doing the work, sometimes the simple things are what elude you. That is usually the case with collisions, as I'm finding. With time I know I'll build the experience reflex to naturally just go and solve this type of problem more quickly but for now, my pain can be your gain!
Scenario:
Let's say you're trying to make a pickup system (coins, loot, guns, health - you name it). You have a player, with a player character mesh. That player walks over something (another object) but you don't get the overlap trigger to run. WTF?! You start debugging and proceed to pull your hair out 1 strand at a time.
Solutions:
First things first, and this is applicable with things like trigger volumes too: you want to make sure the "generate overlap events" is checked (meaning enabled). This needs to be checked on both objects colliding over each other. You'll find this by accessing your static mesh / character mesh and then checking the collision section of the details panel:
Start here.
"But I did that! It's not working!"
Ok next step is to make sure you have defined the collision preset. Your player character should likely be a pawn although you could play around with what custom settings you want for your specific needs. The other object should be one of two things - either something that is configured for overlap or blocks; although you might run into some undefined behaviour with blocking so I'd recommend making sure it's set to trigger for overlap on pawns.
Gee you're such a big help...
Alright so now that you've done that, everything should work (at least for most of the trigger volume folks out there). And this is what everyone else will tell you in all the other help threads like this. Try as you might, the stupid thing still doesn't work though.
Captain Obvious ladies and gentlemen...
Well something I've had to remind myself because we take for granted how much unreal engine does for us: static meshes that we create from converting objects, don't have a collision box set on it by default. You'll run into this challenge a lot if you're prototyping (or just having brain farts, hey they happen).
Why is that important? You can setup your code to do all the collision you want. But if you don't give a collision box (either simplified or complicated) to the static mesh, your code won't trigger because nothing is looking for that event to trigger (even though you coded it to). We also forget this because the player character, especially if you're using the default mannequin, has that collision box already enabled by default. So one side is enabled, the other isn't - you configure all the settings to be identical and this just drives you up the wall.
So the 3rd and final fix is to go add that collision box. You just need to find your static mesh in the content browser:
Double click it to open and edit it.
Then you need to show simplified / complex collisions from the collision drop down:
Note: this won't do anything visibly yet
Finally you need to now add the collision box, which you can do from the collision menu option on the top:
You'll need to pick which type of collision box you want
Add the right collision box you need for your object, then it should show a green outline.
Et voilĂ !
Did Jesus send you?!
No, but I'm glad to hear you're not trying to part the seas by splitting your hairs. I hope this helps all new and veterans alike who find themselves stuck in a simple collision and can't think inside the box ;)
Source: https://www.reddit.com/r/unrealengine/comments/hbahyn/event_begin_overlap_doesnt_trigger_solution/
0 Response to "Does on Component Begin Overlap Call Continuously"
Post a Comment