Using line trace

I’m looking to implement a spell system and was thinking of using a line trace to hit my ai get it’s location and spawning a projectile to that location. The issue I have with it that using a line trace I would need to use an event tick and im not sure if that’s the best way to go about it any suggestions would be appreciated:)

Don’t you just need to ray trace on button/keyboard input?

Like Jez said, you can just set it to a button input to trigger the linetrace. But if you need it to be a continuous firing, I have started setting up my linetraces like in these images. Trigger a “Set Timer by Function Name”. You could just trigger this at event begin play, or trigger from a custom event like I have done. Then create a function and set up all of your linetrace in that function. Call that function name in the “Set Timer by Function Name”. From there you can set it to looping, and set the time for how often it needs to loop. I found my linetrace in this instance was fine to call it every 0.1 seconds.

Looks good it’s it costly on the game though ?

Not as bad as event tick. Its 1/3 the cost at 30fps, and 1/10th the cost at 100fps. Unless im missing something.

That’s right. But it would be a rare use-case that needed more than a single line trace on event.