Gyroscope sensor


#41

it work for some times and show numbers, but most time show message Dis NaN.


#42

ok so that means the touch data is not showing up.
Here try the next one. if you still get errors try it in the pc app. there will be debug data listed as you use your mouse. remember to click and drag.

Touch Test ver 3.zpp (188.1 KB)


#43

From iphone when i first click it show Dis Nan, but when i remove my finger and then clicked again in the screen it show numbers.
and some time it show numbers.

from desktop most of the time it show numbers. but some time it show Dis Nan.


#44

so from iphone if you touch and move your finger back and forth do you get number?


#45

From most of the time first click on the screen it show Dis Nan, and when you drag left , right it will not show numbers at all, you need to click again and then it will work good and it will show numbers.
but also there is situation that it will work and will show numbers from the first touch.


#46

Try this one
Touch Test ver 4.zpp (188.1 KB)

If you get any Nan then run it in windows zapper app and take a photo of the debug data


#47

it show Dis Nan.
and from desktop most time it work good.


#48

is this data from after you moved your mouse?
because the X Data and the lastX Data should not be the same.


#49


this data come from only one click on the mouse, and i remove my finger and do not change the position of the mouse


#50

Ok do a click and move. the data will change just like when you would touch the iphone screen.


#51


i click in the screen and drag top with the mouse


#52

Ok try this zpp file
Touch Test ver 5.zpp (1.5 MB)


#53

from iphone it change the number, not at all the view .
from desktop it work , but some times it change number witohut changing the view, mean i am clicking on the screen, and drag left and right, it change numbers, but not changing view at all .


#54

That’s all the code. we added one part at a time. there should be no reason it shouldn’t work all the time on both desktop and iphone.

We are going to have to talk with the zapper guys. Maybe they can see something I don’t.
@sebastian @George Hay guys any Ides on whats up here?

We will have to wait on them now.
which is ok because it’s the end of my work day and I’m just about to leave soon. I’ll check in tomorrow to see if they say anything.

Steve


#55

Thank you dear, thank you a lot for your time .
let wait and see…

Have a good day ahead there.


#56

Hi @eliaskhs,

We have received your support ticket and have replied to you on there.

Will let you know in this thread if we get it sorted @stevesanerd.

Thanks,

George


#57

Hello thank you for your respond .
replayed.


#58

Finaly with the help of the support team we fond the solution
this is the code.

var mObj = symbol.nodes.Photo_Sphere; //the node or object you want to rotate
var lastX : number // This is needed for storing distance between frames.
var lastY : number // This is needed for storing distance between frames.
const rotSpeed = 100; // Constant to be multiplied by movement on the plane to determine how fast the object will rotate.

// This function activates when the user moves thier finger on surface covered by the parent plane object.
parent.on(“pointermove”, (_e)=> {
let _distX = _e.localPosition[0] - lastX; // how much we’ve moved between frames.
let _distY = (_e.localPosition[1] *-1) - lastY; // how much we’ve moved between frames.

let _rot = mObj.rotation();                 // Get current rotation so we can alter one axis.


_rot[1] += _distX * rotSpeed;    // change the rotation based on distance, multiplied by desired speed factor.

// _rot[0] += _distY * rotSpeed; // change the rotation based on distance, multiplied by desired speed factor.

mObj.rotation(_rot);            // Set the nodes rotation to the new rotation.

lastX = _e.localPosition[0];  // record where the user is touching the screen this frame for next time they move.
lastY = _e.localPosition[1] * -1;  // record where the user is touching the screen this frame for next time they move.

});

// This function is also necessary to get the initial position of the users touch.
parent.on(“pointerenter”, (_e)=> {
lastX = _e.localPosition[0]; // Set initial position when user touches the screen.
lastY = _e.localPosition[1] * -1; // Set initial position when user touches the screen.
});


#59

Ok so why does the code work for me and others but not you?

Steve


#60

Hi @eliaskhs and @stevesanerd,

The problem that we found was that if the first value from the pointer down function was returned as NaN (which it sometimes was), then the rotation script would not work and the whole project was void.

The work around, is to change the parent.on(“pointerdown”) function to a parent.on(“pointerenter”) therefor saving an actual value every time the project is interacted with for the first time.

Glad we figured this out!

George