Pointermove on plane not working

Hello, i am trying to drag a plan with the finger and after a lot of tries i got that the pointermove stop working suddenly.
While i am pressing in the plan, the plan not dragging .
Is there anyone can help me please how i can solve this issue?

I am using this code.

const A_png = parent;

parent.on(“pointermove”, (e) => {

var fingerPosition = e.screenPosition; // pointer position: x,y

var parentPosition =A_png.position(); // plane position: x,y,z

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

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

A_png.position(parentPosition);

});

Thank you.

Hi @eliaskhs,

I have replied directly to the email you have sent through to support@zappar.com but I thought I would explain on here also in case it would help others.

The code snippit you have added has a minor issue but should work perfectly fine.

There is no need to reference the parent node, to bypass this step you can just add parent where the reference to the image was before.

For example:

const A_png = parent;

parent.on(“pointermove”, (e) => {

var fingerPosition = e.screenPosition; // pointer position: x,y
var parentPosition =A_png parent.position(); // plane position: x,y,z

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

A_png parent.position(parentPosition);

});

Both ways will work but as best practice this is unnecessary.

Hope this helps.
George

3 Likes

Hello George.
i do not think that it working good.
it stop working randomly, when you drag the plane little bit more faster, the plane will not be dragged .
is there any solution for this ?
i am using iphone for testing ,

Best regards.
Elias.

Hi @eliaskhs,

Taking the example project that you sent over, we notice that the planes have small interactive areas with the pointer enter/move scripts applied directly to them. This means when moving your finger across the screen quickly, your finger moves out of the interactive hotspot zone and the plane stops moving.

There are two ways to reduce this issue from happening.

  1. Scale the planes up so the interactive area is larger.

  2. Create a larger invisible hotspot plane with the pointer enter/move script applied to it and change the relative to property of the original plane to make it move with the hotspot is interacted with.

Hope this helps!
George