Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to get location of a spawned actor?

Hello, I am very much a beginner to UE4, but i managed to get some simple things to work via the help of tutorials and all. But now i am stuck at how to get a location of an object that is spawned in on click.

I basically want to spawn an object at the cursor location of the mouse and then teleport my character to that location. After which, once the character is at that location and overlapping the spawned object, that object will be destroyed.

I got the actors to spawn at mouse cursor location (more or less) and got it to be destroy on overlap with the character as well, now i am trying to figure out how to a transform location of the spawned actor to teleport my character to that location.

As I am writing this, I am also releasing that don't really need the actor for teleport location, instead i could just teleport the character there with the help of mouse cursor location, but i would like to try my way once anyway as i am almost there.

Product Version: UE 4.20
more ▼

asked Apr 01 '19 at 01:48 AM in Using UE4

avatar image


avatar image Nebula Games Inc Apr 01 '19 at 02:12 PM

Welcome IRishOnline, to do this you will need to get a reference to your spawned in actor (assuming your player BP isn't the one spawning the actor). So from within the player BP you will need to either use a node like "get all actors of class" (ok if you only spawn one actor in), or from the spawning blueprint get a reference to your player character by using the node "Get Player Character" and the cast the output to your player character. Once you have that you can set variables inside your player character one of which can be the location of this actor. Or you can directly teleport the player from the spawning blueprint using the transform of the spawned actor. Moving the character from within the spawning blueprint is probably the easiest method. If you need help understanding casting/references check out the tutorials below. It is a very beginner friendly series that goes over much of the basics of creating game play mechanics in blueprints.


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

You could store its Transform in a variable on its BeginPlay event (using Get Actor Transform) then have it Casted to your player Pawn to be used for teleportation.

more ▼

answered Apr 01 '19 at 04:38 AM

avatar image

503 2 9 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

There's no reason to store anything actually, why not just Get Transform of the actor. Also, no need to cast anything - both inherit from Actor.

more ▼

answered Apr 01 '19 at 01:40 PM

avatar image

14.8k 77 25 62

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question