Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class test : MonoBehaviour {
  5.  
  6.     RaycastHit hitFire;
  7.     Ray rayFire = Camera.main.ScreenPointToRay (Input.mousePosition);
  8.    
  9.     // Use this for initialization
  10.     void Start () {
  11.    
  12.     }
  13.    
  14.     // Update is called once per frame
  15.     void Update () {
  16.             AimAndFire();
  17.     }
  18.    
  19.     void AimAndFire(){
  20.         if (Input.GetMouseButtonDown (0)){
  21.  
  22.            
  23.             if (Physics.Raycast (rayFire, ref hitFire)) {
  24.                 //var fireDirection = (hitFire.point - transform.position);
  25.                 //fireDirection.y = 0;
  26.                 //var rotation = Quaternion.LookRotation(fireDirection);
  27.                 //transform.rotation = rotation;
  28.                 Debug.Log("Hit!: " + hitFire.point);
  29.                 GameObject.Find("Sphere").GetComponent(SteerForPoint).TargetPoint = hitFire.point;
  30.             }  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement