October 2017
Intermediate to advanced
548 pages
13h 23m
English
The ScaleTool we wrote for HoloLens doubled as a teaching example of the GestureRecognizer, and thus made things more complicated than they should be. For the mobile version, we'll just rewrite the script so it's much more similar to the MoveTool one. Here is the whole thing:
File: ScaleTool.csusing UnityEngine; public class ScaleTool : MonoBehaviour { private PictureController picture; private bool isEditing = false; private Vector3 originaButtonScale; //Used to calculate the mouse position private Vector3 startPosition = Vector3.zero; private Vector3 currentPosition = Vector3.zero; private Vector3 initialScale = Vector3.zero; void Start() { picture = GetComponentInParent<PictureController>(); originaButtonScale = transform.localScale; ...