How to make a camera zooming?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ternarycat

Hi.
I want to make camera zooming on mobile devices. How can i do this?

how to realize zooming with multitouch?

Ternarycat | 2019-07-14 14:33

:bust_in_silhouette: Reply From: Dlean Jeans

For Camera2D, change the zoom property.
For 3D Camera, change fov for Perspective projection or size for Orthogonal projection.

okey, i know it. how connect this whith multitouch?

Ternarycat | 2019-07-14 14:32

There’s InputEventMagnifyGesture with a factor property. I guess you can use it like this:

func _input(event):
  if event is InputEventMagnifyGesture:
    camera.zoom *= event.factor

Haven’t tested it yet but this should get you started.

Dlean Jeans | 2019-07-14 15:04