Пример #1
0
    public override void ScaleorRotate()
    {
        float      pinchAmount     = 0;
        Quaternion desiredRotation = transform.rotation;

        CameraClass.Calculate();

        if (Mathf.Abs(CameraClass.pinchDistanceDelta) > 0)   // zoom
        {
            pinchAmount = CameraClass.pinchDistanceDelta;
            scale();
        }

        if (Mathf.Abs(CameraClass.turnAngleDelta) > 0)   // rotate
        {
            Vector3 rotationDeg = Vector3.zero;
            rotationDeg.z    = -CameraClass.turnAngleDelta;
            desiredRotation *= Quaternion.Euler(rotationDeg);
            rotateObj();
        }


        // not so sure those will work:
        transform.rotation  = desiredRotation;
        transform.position += Vector3.forward * pinchAmount;
    }