333GameStudio

Liness

Mar 2nd, 2017
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma strict
  2. var gun : Transform;
  3. var projectile : GameObject;
  4.  
  5.    function FixedUpdate()
  6.     {
  7.          
  8.         var lr : LineRenderer = gameObject.GetComponent.<LineRenderer>();
  9.         //Finds line renderrer on this object.
  10.          
  11.      
  12.  
  13.         lr.SetPosition(0, gun.transform.position);
  14.        //Sets the 1st position of the line renderrer(end and start position).
  15.         lr.SetPosition(1, projectile.transform.position);
  16.        //Sets the 2nd position of the line renderrer(line renderrer will be drawn beetwen those 2 points(gun, projectile).
  17.     }
  18.     function Update(){
  19.    
  20.    
  21.    gun = GameObject.FindWithTag ("end").transform;
  22.    //sets the Transform on variable gun to be the object with a tag end.
  23.  
  24.  
  25.    
  26.     }
  27.     //Script to create laser/line effect beetwen 2 random points.
Advertisement
Add Comment
Please, Sign In to add comment