Guest User

Untitled

a guest
May 27th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. var laserAngle : Transform;
  2. var cursor : GameObject;
  3.  
  4.  
  5. function Update(){
  6.  
  7. if(cursor == null){
  8.  
  9. cursor = GameObject.Find("Cursor(Clone)");
  10. return;
  11. }else{
  12.  
  13. }
  14. var hit : RaycastHit;
  15. if (Physics.Raycast (transform.position, -Vector3.up, hit)) {
  16. var distanceToGround = hit.distance;
  17. Debug.DrawLine (transform.position, hit.point);
  18. }
  19.  
  20.  
  21. transform.position.x = cursor.transform.position.x;
  22. transform.position.z = cursor.transform.position.z;
  23. transform.position.y = hit.point.y + 1;
  24. laserAngle.transform.LookAt(transform.position);
  25.  
  26.  
  27. }
Add Comment
Please, Sign In to add comment