specifying a location.


I’d like to know if there’s a way to specify/reference a certain location in the scene instead of using the make vector.

Attached is my blueprint task_pickrandloc for the behavior tree in which i’d like to replace the make vector by, let’s say a target point.

I’m pretty sure there must be a way, so please enlight me:)


What do you try to do? In a 3d system there is no other … or better no easier … way to specify a point then using a Vector3. You can, if you want, place a dummy object at your desired point, move the object if needed and always call get world location on it. But at the end that is just the same, a Vector3.

Do you just want to generate this vector dynamically or something else?

If you want it to be dynamic just create a vector variable. Then use whatever process to determine how that variable will be set.

So if you already have a location in mind, use something in that location, pull it’s vector, and feed it into your random point origin.

I made kind of PacMan game, and had similar problem. How to tell AI where to go with something easier than numbers in vectors.

So I made dummy BP class that was just marker (invisible in game), then i stored references to all markers in array,
and instead of silly numbers I could pick reference from array then ask that dummy BP where it is (its location).

Much easier to play around and to move markers.

JOHIsaac, Zeustiak , Nawrot :

Thank you for you answers,

I think each of the solutions you are discussing would fit my needs, but i don’t even know how to store references to some dummies in the viewport and using it to replace numbers in my task_pickrandloc.

The thing is , i don’t know how to have some dummies to “talk” to the task.

What Nawrot says about making a dummy BP is exactly the kind of stuff i’m trying to do.

So, sorry about my blueprint ignorance, i’m very curious on how to achieve this.

I’m also posting the blueprint i’ve made (with the help of some tutorials) to achieve the AI characters spawning, then going in some destinations.

Thank you for your help:)

Make new blueprint class, call it “marker_BP”, add to it some mesh, give that mesh bright emmisive material, set it as invisible in game (visible in editor only), and as collision only overlap player or pawn. Compile and place few of those in level.

Next part can be done only by level blueprint, because only level knows those spawned instances. For it use event “begin play”.

Make “ForEach Loop” and set its class to “marker_BP”. Now either build array of vectors out of results, or store pointers/references.
Drag out connection from result pin of “ForEach”. Now you need to make “cast as” node. Start typing NAME of your marker_BP. There should be cast node. Place it. Cast node works as reference to one of your markers.

Now get its location, or better yet use it transformation (ie. location+rotation+scale). Store either transformation or just location into array.

You should have nice array of marker_BP locations/transformations.

Thank you Nawrot !

I’m a little bit confused, when you say “Make new blueprint class”, when i’m creating a new blueprint, in the “pick parent class” window, what type of blueprint do i have to pick?

Also, i don’t know how to build array of vectors out of results, can you detail this aspect a bit?

Thanks again !

For marker class you can use just “Actor” as parent.

Making array is bit tricky:
first make variable of type you want to hold in array, or have any pin that has result of this type.
drag out connector from that type (reference to “marker_BP” or vector/translation, in your case)
then type in “make” there should be make array node, place it, it should assume type as array of things you connected to it.
That was for manually making array.

But for you would be better to build it by blueprint execution:
Add new variable to blueprint either vector/translation or “marker_BP_C”. Adding vector array is easy, make vector variable, then click that 9 yellow squares next to it to turn variable into array.
For storing “marker_BP” references: in new variable dropdown type write “_C” it will bring list of classes, purple names are references to class “virtual” objects, blue names there are references to spawned/allocated objects of that class.

When you have array of variables you want, You need to store values in it.
type “array” in list of bp nodes in right panel. It should bring various nodes for arrays. You can use “insert” “add” there. Just set “expand size” checkbox in node.

Same way for getting values out of array, type array there and you should see get node.

PS. arrays are one dimensional, to make it 2d you need to calculate index from row,col values.
Best way of storing custom data type is to make custom Blueprint that has variables you need to store,
Then spawn those blueprints in level and add references/pointers to them in array.

Thank you sir !

I’m trying it right now.

Here is setup that works, i had no unreal when i wrote stuff above.

get all locations.jpg

Wow thanks Nawrot, this helps a lot actually, i gave up yesterday, i was stucked on this array stuff, didn’t understood how to build it.

This happens in the level blueprint right ?

But the thing is , how to use it in my blueprint task, i mean now you have stored those markers locations, how to feed it in my task.

Again sorry for my newbiness and thanks taking time to answer !

Do not worry i was digging trough all that stuff for 2 weeks before i could understand what is going on.

To get that data over, make vector array in blueprint that needs it. Then get reference to that BP and fill up array there.
I am not sure how you want use that pick_rand_loc task.

Easiest way to make this is to place that random loc blueprint inside level bp, then you go trough markers locations and build local array in level BP.
For it use event “begin play”, so its done only once.

Then make vector variable inside mycharacter (or whatever bp uses that rand location thingy).
Pick random vector from array, and set that variable inside myCharacter or other BP.

ps. I wrote how to pass data over in another topic here (with pics):