So i have a actor witch spawns the same static mesh over and over again in random locations and objective is for the player to prevent the static mesh from colliding with each other. How do i make it says when the static mesh collides it triggers and event. I already know what event it’ll trigger but i don’t know how to make it trigger through the static mesh collision. I understand you need to go to the static mesh editor and add a collision witch i already done, but that’s all i got and cant figure out the rest. If anyone could help that would be awesome!
You need to enable Collisions for the mesh in the BP graph. Select the mesh in the component window, find the collision settings in the details panel and set it to something appropriate, like “OverlapAll” or you can do custom and manually adjust the settings to your liking/needs. Then you can use the nodes “OnBeginOverlap” and “OnEndOverlap” to run your logic.
Hope this helps! If it does please do me a favor and accept the answer by clicking the check mark located under the arrows next to the answer. You’ll know you got it right when the answer highlights green! Thanks!
Ok so i added a box collision connected to the actor and set it to block all dynamic and enabled hit events. I connected the on component begin overlap node to quit game so when the to spawned static meshes collide it quits the game. However when i started the the game it automatically quit the game after like a .1 sec when i pressed play. Why is this happening?
Ok i kinda figured it out. instead of using a box trigger i added a collision in the mesh editor and went to the actor #1 and set the mesh it self to overlap all dynamic, enables hit events, and enabled generate overlap events. That seemed too do the trick and the collisions are triggering the event i set in game. However when i set the mesh to overlap all dynamic and press play the collisions work, but i’m not able to destroy the meshes through On input touch begin. When i set the static mesh to block all dynamic it allows me to destroy the mesh but the collisions don’t work. Any idea why this is happening?
Because for whatever reason you are colliding as soon as you start. You set the collision on the actor and having it “blockall” which includes your actor so this is most likely why this is happening. To generate overlap you don’t want to use “blockall” you want to use “overlapall” or “overlapalldynamic”. However, it may be best to set it to “custom” then expand the collision settings and select only the things you want your collision to overlap with and set the rest to “ignore.”
None of these help. By “logic” I mean show the code you have which generates the collision not what happens after the collision. On your “On Begin Overlap” event, “Cast” the “Other Actor” pin to the object you want to check collisions with (if it’s the same as the BP you are putting it in, that’s fine just cast to the BP you are using.) Then off “Cast Succeed” draw a “Print String” rather than a “Quit” just for the debug purposes. That way, it only checks collisions of an actor from that class and ignores all others. The collision should not interfere with itself, assuming you set up your collisions properly. Also, if you have a collision bounds on your actor, you shouldn’t need a collision box attached to the actor.
Good, glad to see you get it working! I’m not familiar with “On Input Touch Begin.” Seems like a mobile device command? To destroy the actor, from the “OnBeginOverlap” event, assuming you followed what I wrote above about casting, then take that actor you cast too and as the last node in the setup use “Destroy Actor” and plug that casted actor into it as the target.
Ya it’s a mobile command. it’s an OnClicked command, but for mobile. I tried to figure out what you said about the casting, but as you can see i’m not the best blueprinter and kinda knew. Could you post a screenshot of a blueprint making the destroy actor work through OnClicked/OnInputTouchBegin? If not that’s fine ill figure it somehow. Thanks for the help!
This may not be 100% correct but the destroy actor node is what you need to destroy. If this code isn’t put on the actor that you want to destroy then you will need to plug a reference to the actor into the Destroy Actor’s ‘Target’ pin.
Thanks for the blueprint! I don’t think you need a custom event for on input touch begin because there’s already one built in that I use. I’ll try this out when I come home and let you know if it works
Yeah the error is saying your binding is incorrect. What I did to make my binding was just right click type “oninputtouchbegin” and selected to “Assign…” (Don’t remember what it said after assign) it and it gave me both the bind and the event already attached
Hey i came back home and tried it out and did exactly as you said and looks exactly like your blueprint, however when i click on the mesh it doesn’t get destroyed. How is this working for you? I have my mesh itself set to OverLapAllDynamic. Are you sure this is set for you too?
Hey i came back home and tried it out and did exactly as you said and looks exactly like your blueprint, however when i click on the mesh it doesn’t get destroyed. How is this working for you? I have my mesh itself set to OverLapAllDynamic. Are you sure this is set for you too?
I haven’t tested any of this out. I’d have to setup an entire game like yours to be able to truly debug it and see if everything worked correctly. Is “Circle1” the mesh or the blueprint? If it’s the mesh, you need to destroy the blueprint.