I have set up a damage/health system, and I’m trying to make the (FPS) player character (capsule) take damage when it overlaps the cactus’ collision mesh.
I am an audio guy, and I’m not sure how to set this up. I have 3 Cactus static meshes in Content browser, but I cannot double click on them in the level itself in order to see the details. When I open the static meshes from the content browser, I have the option to add a collision. I am also unsure if these “foliage instances” can even serve such a purpose.
Hello, Jegunainen! Welcome to the Unreal Engine Forum.
I have a question for you. How long have you been using Unreal Engine? I’m asking so that I can provide you with better assistance.
To address this, I recommend conducting a test using the following steps:
Create a blueprint for your cactus, specifically an actor type. Within the blueprint, add the cactus mesh. In the top left corner, click on “Add Component” and search for “collision.” Choose the collision type that best suits your needs, whether it’s box or sphere collision.
Open the event graph for your cactus mesh and add an “On Component Begin Overlap” node from the recently created collision.
Following these steps, refer to the screenshot I’ve taken below. The “orange” portion should be created within your character blueprint.
Please let me know if you have any questions. If you manage to replicate the setup shown in the screenshot, you should achieve the desired outcome. Feel free to add more elaborate animations or attack reactions later to enhance the overall experience.
PS: The reason for the “Hammer” float is because I took it from my project blueprint. As for the “not equal” part, I set it to “reference to self” in your case to ensure that the cactus doesn’t inflict damage upon itself.
Unfortunately, it didn’t work. I am very new to the engine, but I’ll do my best to help you help me with my limited UE vocabulary. So here is a list of things I have tried:
-Tried toggling Generate Overlap Events (Mesh files, collisions in BP, and the player collision) left it on
-Tried applying different collision preset combinations to both the player and the meshes/blueprints left at blockall for cacti, pawn for character
-Tried applying different events to make it work (on component hit, on press LMB, etc.)
-Tried casting to instancedfoliagestaticmeshcomponent (and class) to register hit from the player BP
I am not getting a print string reading from these sort of events. I might be a n00b, but something smells like improper collision settings.
-Not sure if this makes any difference (or sense), but in the components window, in the case of the player, the capsule is the uppermost child to the Player_BP, whereas in the case of the Cactus Static Mesh, the capsule component is a child of the static mesh.
-The damage/health settings are working fine with self-induced and fall damage.
Solved it by creating an On Component Hit in the Player_BP, casting to the InstancedFoliageActor component class. The foliage is procedural, so I had to do it from the Foliage mode. Working on excluding actors I don’t want from the selection…