Hi, i made a PickUp System, where the player can take the Pickup ONLY if the PickUp is in the CrossHair, but i'm not sure i've done it the right way. Problem is i'm using a LoopFunction and a Cast every Tick, to check which PickUp im targetting.
My blueprint in the detail :
I heared that Cast nodes can make some problems. With this system i will have performance issue in the future, right ? How should i optimize this ?
Well, i think "Tick" is a bit of overkill for what you are trying to do as Caimartin said, i think creating a "sphere collision" component as an "overlap" trigger volume will create the "in range" effect (not sure if that's what your code currently is doing by "overlap sphere" but if it is then that's perfect) Cast once to the player character "on begin play" and save the output as a variable to be used later. Then just hook up the "begin overlap" to a branch with the condition "equal object" and use a reference to your player character (saves you from recasting) if true "Add Timeline", create an event track and have it execute every 0.2 seconds or so a function that line traces out from your camera and the rest of your code can pretty much be the same. But this way you replace the tick with a Timeline that only executes when the player is within the collision radius, and you only cast once instead of each time the overlap is triggered.
answered Feb 27 '18 at 05:14 AM
Nebula Games Inc
Follow this question
Once you sign in you will be able to subscribe for any updates here