Hi im new to UE4 and im having trouble trying to work out the code to an on component hit event. What i want is to use an array to store vector information then to fire a projectile that when hits an object it finds and spawns a new actor to the closest vector on the hit point but i just cant seem to work and ive been stuck on this for a while please help i created many different variations with similar results that just dont work properly and its frustrating.
So, this is the ball BP. And the ball, when it’s collision box overlaps with another actor ( component? ), it spawns something near that actor?
When is the array of vectors populated?
Do you want to spawn the new actor at the closest point from the array of actors?
yes exactly what i wanna do
Create a custom function to determine the closest vector in array. Vector Array must be pre populated prior to custom function call.
- **Vectors **(array)
- Closest Distance (float, function local var) … default is a ridiculous high number … 200,000.0
- Closest Index (int, function local var) … default 0