# How do you get the boundary indices of grid?

**URL:** <https://forums.unrealengine.com/t/how-do-you-get-the-boundary-indices-of-grid/473887>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [November 2, 2020, 4:45pm UTC](https://forums.unrealengine.com/t/how-do-you-get-the-boundary-indices-of-grid/473887 "2020-11-02T16:45:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SwordsKeyboard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SwordsKeyboard](https://forums.unrealengine.com/u/SwordsKeyboard)\
**Post date:** [November 2, 2020, 4:45pm UTC](https://forums.unrealengine.com/t/how-do-you-get-the-boundary-indices-of-grid/473887/1 "2020-11-02T16:45:49Z")

</div>

I know you can use modulo %10 to get one side of a grid, how would I get the other 3 using math without having to specify each target index.

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/0/75019d835adf0475ed8fd0b83404675d66048564.png)

So using math, how would I get the indices of the outer grid?

This is my working solution so far.

[](https://i.imgur.com/GNwW5sv.png)

[](https://i.imgur.com/RzlwE60.png)

---

<div class="post-metadata">

**Author:** ![SwordsKeyboard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SwordsKeyboard](https://forums.unrealengine.com/u/SwordsKeyboard)\
**Post date:** [November 2, 2020, 5:35pm UTC](https://forums.unrealengine.com/t/how-do-you-get-the-boundary-indices-of-grid/473887/2 "2020-11-02T17:35:22Z")

</div>

My current limitations are having to use grid sizes with a 5x5 base

[https://i.imgur.com/3CICpJs.png](https://i.imgur.com/3CICpJs.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 2, 2020, 8:47pm UTC](https://forums.unrealengine.com/t/how-do-you-get-the-boundary-indices-of-grid/473887/3 "2020-11-02T20:47:05Z")

</div>

Is is easiest to work it out during spawning?

I have two loops:

 ![320916-screenshot-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/4/4/d44c3ed0d5ba740a7d9d5a76e74ec612ee53db92.jpeg)

and they spawn a cube:

 ![320917-screenshot-3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/9/5d945847aef5d2cd81410c93f4b85fb2efa5bc7b.jpeg)

Then you can figure out where the edge is:

 ![320918-screenshot-4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/e/bfe45e9bdb94df17d0c1746981a3ff0422f5c57e.jpeg)

![320919-screenshot-5.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/f/9bf022ff506effd3fcc70a10a5dc91f4ce43e35d.jpeg)

---

<div class="post-metadata">

**Author:** ![SwordsKeyboard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SwordsKeyboard](https://forums.unrealengine.com/u/SwordsKeyboard)\
**Post date:** [November 9, 2020, 12:47pm UTC](https://forums.unrealengine.com/t/how-do-you-get-the-boundary-indices-of-grid/473887/4 "2020-11-09T12:47:43Z")

</div>

Wow thanks for this!
