2014-07-13 57 views
0

我正在为Android制作汽车游戏,并且我创建了节气门,休息和方向盘。GUI.DrawTexture和GUITexture多点触控

所有工作都很好,但当我接触油门或刹车时,我不能使用方向盘。 或者当我使用方向盘时,如果我碰到油门或断开,方向盘有点搞乱。

油门和突破都GUITexture, 方向盘使用GUI.DrawTexture(因为GUITexture不支持旋转)

我检查这样的接触:

int touchCount = Input.touchCount; 
     for (int i = 0; i < touchCount; ++i){ 
      Touch t = Input.GetTouch(i); 

if (t.phase != TouchPhase.Ended && 
       this.throttleButton.texture.HitTest(t.position)){ 
       throttle = 1f; 

      } 

if (t.phase != TouchPhase.Ended && 
       this.brakeButton.texture.HitTest(t.position)){ 
       brake = 1f; 
      } 
     //inputGuiPosition variable was used because Unity3d GUI system is a little opposite 

     Vector3 inputGuiPosition = t.position; 
     inputGuiPosition.y = Screen.height - inputGuiPosition.y; 

     if (t.phase == TouchPhase.Began && 
     wheelRect.Contains((inputGuiPosition))){  
     steerInput = SteeringWheel.GetAngle() * (-1f/270f); 

      } 
} 

回答

1

这是因为Unity的GUI没有按” t支持多点触控。如果您想在Unity游戏中进行多点触控,则需要统一资产商店的一些输入触控资产。