SHARE
TWEET

Untitled

a guest Aug 25th, 2019 85 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 Raketa : MonoBehaviour
  6. {
  7.     public Rigidbody2D rb;
  8.  
  9.     private bool isPressed = false;
  10.     private void Update()
  11.     {
  12.         if (isPressed)
  13.         {
  14.             rb.position = Camera.main.ScreenToViewportPoint(Input.mousePosition);
  15.         }
  16.     }
  17.     private void OnMouseDown()
  18.     {
  19.         isPressed = true;
  20.         rb.isKinematic = true;
  21.     }
  22.     private void OnMouseUp()
  23.     {
  24.         isPressed = false;
  25.         rb.isKinematic = false;
  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