Download

How to spawn an actor just in front of the player at a set distance?

How to spawn an actor just in front of the player at a set distance?

In a BP, do a getactorlocation of the player you want to spawn in front of. That should be a vector. Connect a Vector + and add whatever offset you want. Plug that vector into a spawn actor. It probably will require a transform. For that, just plug the vector into location in a MakeTransform.

Another option would be to place a component (sphere, cube arrow, whatever) on your character blueprint where you’d want the object to spawn. (be sure to set the rendering of said component to unseen by player). Name your new component “SpawnPoint” or whatever you want and position it in the viewport where you want your stuff to spawn. Then, when you’re ready to spawn your pick-up or whatever cast to your player character, use GetWorldLocation of you “SpawnPoint” and SpawnActor of Class with the item pick up as the class.

Something like this:

thats not true.
what you need is “get forward vector” of the actor. multiply it by a float (which is the distance) and add it to the actor location. THIS is now the point in front of you in given distance. plug it into the “spawn actor from class” transform

2 Likes

Answer from MajekPL is correct, this is how it’s done in bp’s: