Pinch to zoom gesture

Hi,
I am new to Defold engine and I want to create a pinch to zoom camera for mobile devices, but I haven’t found any example for making it. Can someone help me?

1 Like

Have you had a look at the camera example? There you get to see how the render script should be modified to be based on a game-object scale.

  1. Setup a camera game-object which uses a script to change scale.
  2. Add an on_input function to the script, where you listen for touch events.
  3. Loop over all multi-touch events and measure the center and size. If size changes modify scale by delta.

P.S, don’t forget to add multi-touch capturing to your .input file.

2 Likes