# Spawning instanced meshes in box style grid

**URL:** <https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [February 27, 2023, 6:07am UTC](https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381 "2023-02-27T06:07:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klikard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klikard](https://forums.unrealengine.com/u/Klikard)\
**Post date:** [February 27, 2023, 6:07am UTC](https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381/1 "2023-02-27T06:07:05Z")

</div>

I was wondering what more i need to do to make the spheres spawn in like a box style and not just the edges? Example can be seen from image below

 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/a/c7ae59c360c5f9e1e1086ab053bdb663f2306391.png)  
 ![2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/8/4b835af0820467f1677b9dafad79ed41bdcc2f2a.png)  
 ![3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/1/8616472af081c8190abac212fefae607008729ac.png)

---

<div class="post-metadata">

**Author:** ![mmmmGoodDinner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mmmmGoodDinner](https://forums.unrealengine.com/u/mmmmGoodDinner)\
**Post date:** [February 27, 2023, 6:55am UTC](https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381/2 "2023-02-27T06:55:34Z")

</div>

I would just nest your logic into three different for loops, one for each dimension.

 ![Capture](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/c/e4cebe9b03a0eeac4fb7aa5c852f09763db07d08.png)

Here’s a bare-bones approach. You’ll have to play with the transformation based on where you want your actor pivot point to be, but this should give you what you’re looking for!

---

<div class="post-metadata">

**Author:** ![Klikard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Klikard](https://forums.unrealengine.com/u/Klikard)\
**Post date:** [February 27, 2023, 7:42am UTC](https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381/3 "2023-02-27T07:42:46Z")

</div>

Works great, thanks a lot! I just set the world space bool to true and the pivot works fine, can’t seem to see it on your node.  
 ![Skjermbilde 2023-02-27 084335](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/4/05447e4ed282fc80b07afb9b99111039b7f95046.png)

---

<div class="post-metadata">

**Author:** ![mmmmGoodDinner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mmmmGoodDinner](https://forums.unrealengine.com/u/mmmmGoodDinner)\
**Post date:** [February 27, 2023, 8:11am UTC](https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381/4 "2023-02-27T08:11:59Z")

</div>

Great! Also, if you get rid of the addition with the actor location, you won’t need the world space box checked. Forgot that instances get added in local space.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 27, 2023, 11:30am UTC](https://forums.unrealengine.com/t/spawning-instanced-meshes-in-box-style-grid/779381/5 "2023-02-27T11:30:29Z")

</div>

> [@mmmmGoodDinner](#):
>
> Forgot that instances get added in local space.

UE4 has 2 nodes for it, I bet in UE5 it’s a tickbox:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/a/9/da9dae887462443bdccb6ea208642d4d21b2f92a.png)

* * *

Also, this [bad](https://forums.unrealengine.com/t/how-do-i-get-mouse-clicked-position-on-chessboard-mesh/88592/5) [boy](https://forums.unrealengine.com/t/pyramid-construction-using-blueprints/471514/2) exists:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/e/4ce056c44c13796302946b02f89f829a75717c18.png)

It also spits out some extra data, it’s a nice shortcut.
