Character forward vector in level BP

Hi!
I’m working on a flying sidescroller in UE 5.2. Trying to get enemies to spawn outside of the screen and fly in from right to left when the player is entering a trigger box (at the start of the level). I’ve set it up in level bp so it works but can’t get the forward vector to follow the character, 2000 in front of character on y axis. Enemies spawns 2000 on forward vector related to the trigger box. How can I get the forward vector to calculate 2000 in front of the character so enemies keep spawning outside of the screen and fly in throughout the level?
Probably an easy fix I guess but can’t seem to find the solution on my own. Any help would be GOLD! Screenshot of the Level BP.

Forgot to mention that it works fine if I script it in the third person character bp and calls the function with a keyboard button as in screenshot.


Multiply the forward vector * a float.


To reliably spawn enemies outside the screen I’d recommend you calculate the view frustum. This way you don’t have to come back an adjust every time the camera changes (if it every does). Spawns can also be at a constant distance no matter where in the screen, using a fixed distance will make spawned actors take longer to get in screen when they are not near corners.

Thanks for replying! The character can fly up, down, back and forward within the screen. The screen is basicly what you can see within the cameras view since it’s not a sidescroller template with a fixed plane but the third person template (3D). I’m constraining character and enemies to the Y-plane so everything happens there and the camera moves along facing the character from the side. This is why I thought it best to get the characters forward vector and multiply it enough so that enemies spawns just outside of the cameras view. They spawn at multiple point along the Z-axis but constrained to move on the Y-axis. Is there a better way to do this?

You can try this:



Offset = 0 will get location exactly at the right edge of the screen.

This will function correctly in a Standalone Game but may not be precise within the Editor Viewport. It’s also assuming the characters origin will stay at the center of the screen.

Thanks, I will try that and see how it works!