Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 14th, 2012  |  syntax: JavaScript  |  size: 0.54 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function Update (){
  2.         ClickMove();
  3. //      GUIcheck.Reset();
  4.         GUIcheck.guiClick = false;
  5. }
  6.  
  7. function ClickMove(){
  8.         if(Input.GetMouseButtonUp(0) && !GUIcheck.guiClick){
  9.                 var hit : RaycastHit = new RaycastHit();
  10.                 var cameraRay : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  11.                 var layerMask : int = 1 << 9; //only hit on layer 9 "Terrain"
  12.                
  13.                 if (Physics.Raycast (cameraRay.origin,cameraRay.direction,hit, 100, layerMask)) {
  14.                         iTween.MoveTo(gameObject, iTween.Hash("position", hit.point, "speed", 15, "easetype", "linear"));
  15.                 }
  16.         }
  17.  
  18. }