Show node after TriggerRegionEnter


#1

I’m working on a sort of “puzzle” project. I have an image or “node” that starts in a certain position. I’ve used parent.on(“pointermove”, (e) => {
var fingerPosition = e.screenPosition; // pointer position: x,y
var parentPosition = parent.position(); // plane position: x,y,z

parentPosition[0] = fingerPosition[0]; // replace the x
parentPosition[1] = fingerPosition[1]; // replace the y

parent.position(parentPosition);
});

To make it move with my finger and a trigger region so that it goes into it’s proper place when its entered. I then enable the node once entered so that it sort of “locks” into place. I’d like to have a reset button after all the pieces of the puzzle are in there proper places. My question is how do I get my “show” state to play (reset button to appear) once all trigger regions have entered.


#2

Hi @molly.freel,

I replied to your email a while back but I’m not sure if it made it to you.

In case it was lost, or it helps anyone else, here was the reply:

You could add some logic to your code which checks how many ‘images’ are in place.

This could be by incrementing a value each time an image is placed in the correct slot for example.

Once the ‘activation’ logic has been completed, you can then activate the state in which your images are reset, from within a script.

We have an article and accompanying video which offer some more information on using states and controllers within Studio.

All the best,
Seb