Scrolling up and down


#1

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.


#2

Hi @michael.d.robinson,

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

George


#3

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


#4

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


#5

@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


#6

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


#7

Thanks George! I can scroll and activate states now!


#8

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

thanks
Steve