Spawn Actors Grid Formation

I need to spawn my vehicles in a grid formation at the starting line. It is working (kinda) but when I rotate the stating line actor the grid is no longer oriented to the actor and I do not know how to make it do so. How can I make the grid columns always “go right” in relation to the actor right vector no matter what rotation the actor has in the world?


^ This image shows the spawning locations in grid format in the correct orientation when the actor is rotated 90 on Z world.


^ This image shows what happens when the actor is NOT rotated.


^ This is a screenshot of the starting line actor and it’s components.


^ I am using an arrow component as the location to start the grid, it needs to go “right” (Y) number of columns, and then go “back” (X) number of rows until no more to spawn.


^ This shows the inexperienced script I cobbled together so far. I am open to completely re-writing it as I have no clue how to do this.

Here is a video showing more. Help meh, please!?
https://youtu.be/TQ3_FInymAw

1 Like

I’ve had this on a number of occasions :slight_smile:

I believe your problem is related to only taking the X or Y from the forward and right vectors.

You can save yourself a lot of hassle with this node

image

Use it in local space, and then only convert the location to world as the last operation. Then the grid will rotate with the blueprint.

Nice, we are on to something here. So now the grid is always rotated with the actor. I will need some slight modifications to wrap this up.


^ This shows the grid (correct orientation per your suggestion, many thanks), but as you can see I need to offset that center point so that the start is before that dashed white line I drew, then go back from there.


^ This is the script I am working with now, much more simple thank you, but I assume we need to hack it up a little to get the exact result I need. (I am saving these locations into an array that the game mode uses as spawn locations)

  1. Offset the grid to start behind the line and go back from there. (I assume this is our X “direction”?)
  2. The overflow needs to be the next row, after 4 columns go to next row, and only for the total amount; say 8 vehicles only need 8 locations, that would be 4 columns and 2 rows.
1 Like

This is where you can offset everything

image

Just make it a relative offset.

Ah, yes ok, you’re great thanks.

Last challenge is if there is a way to limit the total number of points to the number of vehicles I am giving it?

@Mike-Hardy Did you add the Completed pin to the node or it’s there in 5.4?!

I added that, I need to get that array when it’s complete…

I’d refrain from modifying engine macros if I were you.

But your mileage may vary. GL!

1 Like

Very good point. I figured maybe I could copy/paste into my own macro?

Or just return as above.

Would that return premature?

Nah. It will complete the macro first.

Did you add the Completed pin to the node or it’s there in 5.4?!

Only asking because I got excited - it’s, by far, one of my fav nodes. :blush:

Any idea how I can get index 0 to start at the upper left and go right then down?

This grid starts from bottom up, I need it top down…

I think just rotate it 180 and make the offset the opposite of what it is now?

You might need to just make a copy of the macro and change the order.

Editing that macro caused constant engine crashing, so I copied that into the function. So I need to get index 0 at the top left, then add columns to the right and the rows go down. I have tried all sorts of hackery but I am not getting it. What can I change to make that happen?


^ Current grid result.


^ Current script …

Can you show where the pivot is there? ( where is the location of the blueprint? ).

I’m assuming it’s towards the top of the image… ( top center? )

That is correct, where the billboard is. “StartingLineGridLocation” is the arrow component, I don’t think I really need it…

Hey I think I got it. Beat my head against the wall enough times; I mean, inverted a couple of values and used actor transform.



1 Like

Ok, great :slight_smile:

Sorry, was going to come back today, ran out of time yesterday.