Advertisement
Guest User

PlaceCube.cs

a guest
Jan 27th, 2020
1,257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlaceCube : MonoBehaviour
  6. {
  7.  
  8.     // Update is called once per frame
  9.     void Update()
  10.     {
  11.         if (Input.GetMouseButtonDown(0))
  12.         {
  13.             Vector2 screenpos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
  14.             Vector3 worldpos;
  15.             if (ZEDSupportFunctions.GetWorldPositionAtPixel(ZEDManager.GetInstance(sl.ZED_CAMERA_ID.CAMERA_ID_01).zedCamera, screenpos, ZEDManager.GetInstance(sl.ZED_CAMERA_ID.CAMERA_ID_01).GetLeftCameraTransform().GetComponent<Camera>(), out worldpos))
  16.             {
  17.                 GetComponent<Rigidbody>().velocity = Vector3.zero;
  18.                 transform.position = worldpos + Vector3.up;
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement