Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlaceCube : MonoBehaviour
- {
- // Use this for initialization
- void Start ()
- {
- }
- // Update is called once per frame
- void Update ()
- {
- if(Input.GetMouseButtonDown(0))
- {
- Vector2 screenpos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
- Vector3 worldpos;
- if(ZEDSupportFunctions.GetWorldPositionAtPixel(screenpos, ZEDManager.Instance.GetLeftCameraTransform().GetComponent<Camera>(), out worldpos))
- {
- GetComponent<Rigidbody>().velocity = Vector3.zero;
- transform.position = worldpos + Vector3.up;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement