Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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.
    Origin of Storms

    Comment


      #3
      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:

      Click image for larger version

Name:	spawnLocation.PNG
Views:	1
Size:	98.9 KB
ID:	1107478

      Comment


        #4
        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
        Wishlist us on steam! -> Countryballs: Modern Ballfare
        Join Discord

        Comment

        Working...
        X