SHARE
TWEET

PlaceCube.cs

a guest Sep 6th, 2018 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlaceCube : MonoBehaviour
  6. {
  7.     // Use this for initialization
  8.     void Start ()
  9.     {
  10.        
  11.     }
  12.    
  13.     // Update is called once per frame
  14.     void Update ()
  15.     {
  16.         if(Input.GetMouseButtonDown(0))
  17.         {
  18.             Vector2 screenpos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
  19.             Vector3 worldpos;
  20.             if(ZEDSupportFunctions.GetWorldPositionAtPixel(screenpos, ZEDManager.Instance.GetLeftCameraTransform().GetComponent<Camera>(), out worldpos))
  21.             {
  22.                 GetComponent<Rigidbody>().velocity = Vector3.zero;
  23.                 transform.position = worldpos + Vector3.up;
  24.             }
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top