Pinch to zoom + follow finger

I would like to zoom with the two fingers, but I can’t do this, l have tried to create a button to go increasing the zoom. but it does not work because the var value is reseting I guess. This is my code button:

parent.on(“pointerenter”, (e) => {
// Runs when pointerenter occurs on the parent node
// The argument e contains useful info about this event:
// https://docs.zap.works/studio/scripting/reference/object/events/pointerenter/

var cameraGroup = symbol.nodes.cameraGroup;

var zoom = 0;

var somaZoom;

somaZoom = zoom + -1;
cameraGroup.position([0,0,-3.3 + somaZoom]);

});

This buttom zoom it is just another solution that I tried, but it’s not really what I want. What I want is the zoom with the fingers.

1 Like

I am trying to drag an object I am trying to get the user touch area to position the plane or some object.

I think this is the path:
https://docs.zap.works/studio/scripting/reference/object/interfaces/pointerpresentevent/

but I can’t make the object move to user finger position.

1 Like

I have tried this:

parent.on(“pointerdown”, (e) => {
// Runs when pointerdown occurs on the parent node
// The argument e contains useful info about this event:
// https://docs.zap.works/studio/scripting/reference/object/events/pointerdown/
var thisObject = symbol.nodes.Plane18;
var fingerPosition = e.localPosition;
thisObject.position(fingerPosition);
});

The object moves, but it does not stay at the same finger position and I don’t know if it’s drag the object or just moves the object just in one frame. What I want is while the user is moving the finger the object follow the finger.

1 Like

Hi There,

I’ve merged your two questions together as I can answer them both in one post :slight_smile:

We currently have examples of; pinch to zoom, follow finger and swipe to rotate built into our 3D Photo Feature Symbol.

This is all done in code that can be found in the ‘script’ script node within the ‘onScreenObject’ subsymbol. I will warn you that it is quite complex and uses a fair bit of maths.

At this point in time, we don’t have any specific templates just for this individual functionality but i have passed it onto the platform team as a feature request :slight_smile:

Thanks,
Mark

1 Like

Thanks for your answers.
I would like to make another question related to this 3D Photo Feature Sybomol.
My project is in dragAndDrop, but do be in dragAndDrop My groups and objects are Relative to some object. The quetions is:
How can I make my project DragAndDrop and scalable? I already did a solution which is set the user in to another “scene” (it was using controllers) to scale and drag the object, but it’s not the perfect solution. What I would like is My project draganddrop, scalable without changing to another scene.

1 Like

Hi There,

I’m not sure I fully understand the question. It’s up to you whether you put your functionality all in one symbol or spread it across multiple symbols.

The 3D photo feature template is a separate symbol so that it can be placed into other projects as part of the experience. You are more than welcome to take the code/functionality of this and place it directly into your main symbol.

Thanks,
Mark

2 Likes

Thank you very much for your help. I finished the project.

2 Likes

Mark, I am trying what u are saying but I am not capable of doing that please guide me.

I want that Finger touch option to my 3d model at any cost. Help us

1 Like

Hi Kumar,

Unfortunately we’re unable to provide further assistance with touch functionality.

Please refer to the documentation and examples shown above for more information.

All the best,

Seb

1 Like