How to run a event on a class from an array.
Hey Guy's not sure if my philosophy is correct in this one so some guidance would be nice!
I have a level that is filled with blue orbs, when the use looks at a orb a timer fills and when it is filled an event should be triggers.
How I thought it would work is not working for me because of my. Probably because of my limited knowledge of blue prints or just my limited knowledge of how programming works in general.
How I thought it would work:
Step 1 works
Step 2 works
Step 3 cant seem to fill the array with child blueprints on begin play. however i can fill the array manually in the blueprint.
Step 4 works
Step 5 cant seem to reach the Custom event called Test form the array. And thus not able to run the event.
I could fix all of this by creating the selection process in a waterfall flow, but this is not really scalable.
Any help would be nice!!
If you have your "trigger something on being seen" logic working, then a simple function call to the seen object setting the timer should suffice. What tool are you using for checking visibility? If you're using a line trace from the player character's eyes then there should be a hit actor/component output you could use to see if the hit actor was of the correct type.
Another way you could go about it is by checking the the angle of the character's forward vector against the a vector that starts at the sphere origin and points towards the player. This is often done in AI. It's call dot product. Here's a forum post that seems like it deals with it:
answered Mar 18 '19 at 11:20 AM
Instead of using array, you may only call an inherited event inside child class. Create a function inside your main bp, call it when needed (overlap, hit...) Now inside you child bp, click on override, then you can customize the event for each child.
answered Mar 18 '19 at 11:41 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here