I am making a shooter and my bullet bounce. I am using the physic to do this.
I have a preview of the trajectory on press and shoot on release, this works. The issue is that my trajectory stops at the first wall and I have no idea how to preview the bounce!
I am quite new to the engine (few days) and I look up countless solutions that I either don’t understand, don’t know how to apply to my case or don’t work.
I am not going to comment on your implementation, but you should consider using something other than ‘Tick’ to do this to improve performance. On to your question: The OutHit struct contains what you need. Use the Impact Point and Impact Normal to create your new trace.
I wouldn’t bother with optimisation at this point. If a game of Pool is the goal, you can keep the whole thing on Tick and never look at it again. But maybe you’re going mobile with this and every tick counts!
If you had 100 actors doing 100 sphere traces across 100 huge pool tables, that’d would be a very different story. Here you’ll have a single loop several elements long.
The easiest way to optimise it is to place a Gate behind the Tick event. Open the gate only when the player adjust the angle or there are balls on the move. Otherwise, the last trace result is not stale and can be used to visualise the trajectory.
If you’re going to visualise it with spline mesh components, do note that this can get costly. Still unmeasurable and utterly negligible in this very instance.
Makes total sense, for now just enemies shooting at you and you can only fire one bullet by one and for pc. Just a side project to learn the engine!
Thanks!