[SOLVED] Trying to make AR within a game

Started by RootBound, Mon 20/01/2025 16:43:36

Previous topic - Next topic

RootBound

Hey all,

I'm currently designing the gameplay for a project and am trying to figure out how to make a fairly important part of the game work.

The concept is this: In the game there is a big GUI that looks like a smartphone. When "AR mode" is activated, the phone follows the cursor, and the phone screen reveals hidden objects in the room. I don't want the objects to visibly "appear" but to naturally slide into view--for example a large object could be only half visible, with the half outside the phone GUI remaining hidden--so toggling Object.Visible or Object.Enabled won't really work.

The only way I can think of to attempt scripting this is to have two versions of each room, with one version of the room hidden offscreen, and for the phone screen to be a viewport and camera that lead to the hidden version of the room which contains the hidden objects to be revealed by the phone screen.

Is this the only way to do it? This is going to be a big project with a 50+ rooms, so having two different versions of each room feels like a potentially very inefficient method. Can anyone think of a better approach?

Thanks very much.
They/them. Here are some of my games:

Crimson Wizard

Since the phone is a GUI, you can create hidden objects as Buttons on the same gui, and change their position as the phone moves around.
Buttons are automatically clipped by the GUI's border, so there's no problem in them being only partially in-view.

You probably will need to make 2 GUIs: the first has the phone's frame on it with transparent spot in the middle, and has a higher sorting order; and the second one positioned below is a fully transparent gui with buttons for hidden objects.


RootBound

@Crimson Wizard that is an absolutely genius solution that would NEVER have occured to me.  8-0

I threw together a quick test:




It works perfectly.  ;-D

I figure to set up different objects in different rooms, I can use global variables for the button graphic, button X, and button Y. Then, for interactions, I suppose I can call different room scripts depending on which room the button is clicked in and which object it is set to appear as. Complicated, but very doable!

Thanks so much. I've edited the thread name to reflect the question as solved!   :)
They/them. Here are some of my games:

SMF spam blocked by CleanTalk