Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4.  
  5. using UnityEngine;
  6.  
  7. public class Camara : MonoBehaviour {
  8. int xKordinate;
  9. public Transform transform;
  10. public GameObject gameObject;
  11. // Use this for initialization
  12. void Start () {
  13. transform = GetComponent<Transform>();
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update () {
  18. if (Input.GetKey(KeyCode.Mouse0))
  19. {
  20. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  21. if (Physics.Raycast(ray))
  22. Instantiate(gameObject, transform.position, transform.rotation);
  23.  
  24. Debug.Log(ray);
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement