333GameStudio

Draw

Jan 15th, 2017
928
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var depth = 10.0;
  2.     var pencil : Transform;
  3.      
  4.     function Start ()
  5.     {
  6.          Cursor.visible = true;
  7.     }
  8.      
  9.     function Update ()
  10.     {
  11.    
  12.          var mousePos = Input.mousePosition;
  13.          var wantedPos = Camera.main.ScreenToWorldPoint (Vector3 (mousePos.x, mousePos.y, depth));
  14.          transform.position = wantedPos;
  15.    
  16.     }
  17.     function FixedUpdate(){
  18.     if(Input.GetMouseButtonDown(0)){
  19.    
  20.     Instantiate(pencil, transform.position, transform.rotation);
  21.    
  22.     }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment