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.