Scrolling up and down

Warning: I’m a mimic, I can only script if I have an example to compare against. I’m also super good “find whats different between these pictures” puzzles. Just a random fun fact :).

I’m trying to scroll up and down. Using the “Slider Button Selector.zzp” project, I’m able to scroll left to right along the x-axis with no problem. But for the life of me I can’t figure out how to make it scroll up and down. I’ve used the “Photo-Sphere-Gyroscope v2” example as well and it makes sense when I read it but when i make the modifications to what I’m doing it still only goes left to right. This is what I’ve got.

const Buttons = symbol.nodes.Buttons;
const Touch_Plane = symbol.nodes.Slider;

let lastPos;
let speed = 1.28;

// This function activates when the user moves their finger on touch plane object.
Touch_Plane.on(“pointermove”, (e)=> {
let distY = (e.localPosition[1] *-1) - lastPos; .
let pos = Buttons.position();
pos[1] += distY * speed; .
Buttons.position(pos);
lastPos = e.localPosition[1] * -1; });

Touch_Plane.on(“pointerenter”, (e)=> {
lastPos = e.localPosition[1] * -1; // Set initial position when user touches the screen. });

I’ve also noticed that “relative to” plays a part on items moving. I have all of my buttons relative to – and my “Slider” relative to – as well.

Hi @michael.d.robinson,

I’d have a look at this post, might be better for what you are trying to achieve.

George

This was exactly what I was looking for! Perfect! Thank you sir!

I spoke too soon. The scrolling works but none of the buttons work, I can’t activate a state. Am I missing something?

@michael.d.robinson & @George
I’m glad you got it working because all I get is my items is the Screen Content just jump and I can’t do anything.

As for your buttons working they won’t. you have the tough point to move the Screen Content group on top of your buttons. so you can’t set off your buttons.

Steve

Hi @michael.d.robinson,

In the subsymbol there is a large hotspot which is reacting to user input. It’s currently positioned at 0 on all axis and set to overlay meaning it will take the order in which it is found in the Hierarchy - more information on this here.

We can simply go into the Hierarchy and drag the screenContent exposed attachment point up in the Hierarchy and now the content we have added into the parent symbol will be interactable when scanned.

Hope this helps.

@stevesanerd, what values have you set in the properties?

George

Thanks George! I can scroll and activate states now!

1 Like

This didn’t work I had to set LowerBound to 0 and UpperBound to my number.
But it’s working now.

thanks
Steve

2 Likes

Hi George, does this works on symbols?.. I have made a 2d symbols, imported, and added to the screenContent but it only affect a plane which is too in the same hierarchy.
regards
Luca

Hey @lucalilli,

It should do, not sure what’s happening there.

Could you share the example?

George

Sure…
Regards
Luca

Test-symbol-scrolling.zpp (15.8 MB)

Hi @lucalilli,

I believe the issue here is that the subsymbol and content within it is set to screen relative. If you head into the Santa Claus subsymbol and change the root node to be relative to nothing (-) this will then become relative to the thing it’s parented to in the main parent symbol, in this case, the scrolling menu.

Here’s an example of that in action: Test-symbol-scrolling-support.zpp (15.8 MB)

Let me know if you have any questions.

George

Great!!
Thank you so much!!!
Regards
Luca

1 Like

Hallo, is there a way to make it scroll on the X axis?
Regards
Luca