Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# AR基础-预置2个触摸屏_C#_Unity3d_Augmented Reality - Fatal编程技术网

C# AR基础-预置2个触摸屏

C# AR基础-预置2个触摸屏,c#,unity3d,augmented-reality,C#,Unity3d,Augmented Reality,我正在为建筑行业开发一个增强现实应用程序,需要以1:1的比例放置一个模型。我知道如何一触即放,但我想知道是否有可能设置2个点来锚定我的模型 提前感谢 您可以使用if(Input.touchCount==1)来检测多个手指敲击(同时)。然后,您可以基于双手指触摸放置对象 // Store both touches. Touch touchZero = Input.GetTouch(0); Touch touchOne = In

我正在为建筑行业开发一个增强现实应用程序,需要以1:1的比例放置一个模型。我知道如何一触即放,但我想知道是否有可能设置2个点来锚定我的模型

提前感谢

您可以使用
if(Input.touchCount==1)
来检测多个手指敲击(同时)。然后,您可以基于双手指触摸放置对象

            // Store both touches.
            Touch touchZero = Input.GetTouch(0);
            Touch touchOne = Input.GetTouch(1);
            // Calculate previous position
            Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
            Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition;
            // Find the magnitude of the vector (the distance) between the touches in each frame.
            float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude;
            float touchDeltaMag = (touchZero.position - touchOne.position).magnitude;
            // Find the difference in the distances between each frame.
            float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag;
            float pinchAmount = deltaMagnitudeDiff * 0.02f * Time.deltaTime;
            spawnedObject.transform.localScale -= new Vector3(pinchAmount, pinchAmount, pinchAmount);
            // Clamp scale
            float Min = 0.005f;
            float Max = 3f;
            spawnedObject.transform.localScale = new Vector3(
                Mathf.Clamp(spawnedObject.transform.localScale.x, Min, Max),
                Mathf.Clamp(spawnedObject.transform.localScale.y, Min, Max),
                Mathf.Clamp(spawnedObject.transform.localScale.z, Min, Max)
            );

你到底是什么意思?这两点应该做什么?定义我的模型将在哪里产生。我需要精确地控制3D对象的位置啊,当然,但是。。。描述你的两个职位应该做什么。。互动到底应该如何运作?