纳金网

标题: Transform [打印本页]

作者: 她。    时间: 2013-1-16 08:29
标题: Transform
請問各位大大:在Unity 裡如何當球停止時在鏡頭前面可請取到球停止鏡頭前的x y z軸。我自已設了三個位置,這三個位置是用來判斷當球停止時,正好在我所設的二個位置其中之一就會發出訊息,請問要如何讓這三個位置可以偵測到所對應的球 x y z軸??print("please Press r to start&nbsp***nning");  
var first :Vector3;
var second :Vector3;
var third :Vector3;
   
  
  first=transform.position=Vector3(4.959106e-07,-0.004537945,3.514354);
  second=transform.position=Vector3(4.959106e-07,-0.0045379455,3.514354);
  third=transform.position=Vector3(6.103515e-07,-1.033352,3.333845);
  
          animation.Stop();  function Update () {if(Input.GetKey(KeyCode.R)){  print(&quot***ning");
  
  
  animation.Play();
      
   print("ress c key to stop the&nbsp***n");
   }
    if(Input.GetKey(KeyCode.C))  {
      
  
  
       animation.Stop();
   
     
     if(first.x&&first.y&&first.position.z)
  {

                    print("1");
   
   
}
else if(second.x&&second.y&&second.z)
{
      
              print("2");
     
  }   
   else if(third.x&&third.y&& third.z)
{   
      
             print("3");
}



     }
   

   
  
      
         
   
  
}
  謝謝各位大大回應!! ^^   
作者: 狂风大尉    时间: 2013-1-29 17:54
希望更多的朋友分享制作经验





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5