使用 Lean Touch 和 1 个手指旋转 [英] Rotate using Lean Touch and 1 finger
本文介绍了使用 Lean Touch 和 1 个手指旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 Unity 中使用 Lean Touch 旋转模型,并且只有一根手指?默认似乎是 2.
How can you rotate a model using Lean Touch in Unity, and only 1 finger? The default appears to be 2.
我尝试将所需的手指数设置为 1,但没有任何反应.
I tried setting the Required Finger Count to 1, but then nothing happens.
有什么想法吗?
推荐答案
我遇到了同样的问题.不幸的是,我无法弄清楚.
I ran into the same issue. Unfortunately, i couldn't figure it out.
相反,我将以下代码附加到我的 GameObject.当您的手指从左向右移动时,脚本所附加的 GameObject 会围绕其 Z 轴相应地旋转.
Instead I attached the following code to my GameObject. When moving your finger from left to right, the GameObject the script is attached to rotates accordingly around its Z-axis.
void OnMouseDrag()
{
float rotationX = Input.GetAxis("Mouse X") * rotationSpeed * Mathf.Deg2Rad;
transform.Rotate(Vector3.down, -rotationX, Space.World);
}
这篇关于使用 Lean Touch 和 1 个手指旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文