Beispiel #1
0
    /// <summary>
    /// Do a pinch with a camera.
    /// </summary>
    public static void PinchCameraOrtho(Camera theCamera, PinchArgs theArgs)
    {
        if (itsTempTransform == null)
        {
            itsTempTransform = new GameObject("TempTransform").transform;
        }

        float aFactor = theArgs.itsLengthNew.magnitude / theArgs.itsLengthOld.magnitude;

        itsTempTransform.position              = theCamera.ScreenToWorldPoint(new Vector3(Screen.width - theArgs.itsPointCenter.x, Screen.height - theArgs.itsPointCenter.y, 10));
        itsTempTransform.localScale            = Vector3.one;
        theCamera.transform.parent             = itsTempTransform;
        itsTempTransform.transform.localScale *= aFactor;
        theCamera.orthographicSize            /= aFactor;
        theCamera.transform.parent             = null;
    }
Beispiel #2
0
	/// <summary>
	/// Do a pinch with a camera.
	/// </summary>
	public static void PinchCameraOrtho(Camera theCamera, PinchArgs theArgs)
	{
		if (itsTempTransform == null)
			itsTempTransform = new GameObject("TempTransform").transform;

		float aFactor = theArgs.itsLengthNew.magnitude / theArgs.itsLengthOld.magnitude;
		itsTempTransform.position = theCamera.ScreenToWorldPoint(new Vector3(Screen.width - theArgs.itsPointCenter.x, Screen.height - theArgs.itsPointCenter.y,10));
		itsTempTransform.localScale = Vector3.one;
		theCamera.transform.parent = itsTempTransform;
		itsTempTransform.transform.localScale *= aFactor;
		theCamera.orthographicSize /= aFactor;
		theCamera.transform.parent = null;
	}