Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var laserAngle : Transform;
- var cursor : GameObject;
- function Update(){
- if(cursor == null){
- cursor = GameObject.Find("Cursor(Clone)");
- return;
- }else{
- }
- var hit : RaycastHit;
- if (Physics.Raycast (transform.position, -Vector3.up, hit)) {
- var distanceToGround = hit.distance;
- Debug.DrawLine (transform.position, hit.point);
- }
- transform.position.x = cursor.transform.position.x;
- transform.position.z = cursor.transform.position.z;
- transform.position.y = hit.point.y + 1;
- laserAngle.transform.LookAt(transform.position);
- }
Add Comment
Please, Sign In to add comment