Navigating a 3d grid (VR) inventory without using widgets

I am trying to come up with a BP solution to navigating a grid menu and struggling to think of the best way.

I have an inventory that is basically a 3d menu in a grid of 10 x 8 squares. Each row is assigned to a different type of item. As it is a menu made of 3d objects for VR and is not flat UI grid/widgets do not really work for me in this case.

So for example Row 1 might sometimes have 3 objects in it, Row 2 might have 1 object.

I have a 3d object that operates as a selection box that the player moves around the menu to highlight objects so every grid box needs a transform to allow me to tell the 3d selection object which object to highlight.

I am wondering what the best way of doing this is and how to actually navigate the selection box around. I am thinking of assigning each grid position a number - like 1/1 (row 1, item1) and so on and storing the transform for each grid that way but wondering what the best variable would be to store this. Was thinking possible tables to store them all but seems a bit long winded as there will be 10 x 8 variables to store.

Also wondering what the BP would look like for navigating the selection box - if player presses right/left/up/down and there is no object there then where to go etc, what to do at edges of the menu and so on.

I wondered if there was any particular good nodes or elegent solutions/ setups to use for this kind of system that are already existing within UE5?

Hope this makes sense!

There should be no need to ID / hardcode anything here, faff with row / column numbers. You can, but you may not need to. Consider the following:

Create a grid of invisible slots - simple collision boxes will do.

image

  • trace on a custom channel from the selection object in the direction the player is attempting to move and place the selection at the first slot containing an item. In the above case, selection could only move down

  • there will be cases where there is no object but you may still want to allow the selection to skip to the top row - because it could be more user friendly this way.

In this very case you could multi line trace and, if no items are found, place the selection at the last index of the array of the multi line trace spits out.

  • or you could allow the selection to move to any slot one-at-a-time regardless of whether it contains something - that’d be a design choice for you to make:


The last one would be preferable, otherwise we may get stuck in a spot where there is no other place to navigate to! The whole thing is fairly agnostic, and could work with any item and any shape of the menu - U shaped, for example. And you could allow for directions other than cardinal; intercardinal should be pretty straightforward providing the slot spacing is set right.

2 Likes

Thankyou - totally had not occurred to me to use a trace - will look into this - nice solution

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.