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 Raketa : MonoBehaviour
- {
- public Rigidbody2D rb;
- private bool isPressed = false;
- private void Update()
- {
- if (isPressed)
- {
- rb.position = Camera.main.ScreenToViewportPoint(Input.mousePosition);
- }
- }
- private void OnMouseDown()
- {
- isPressed = true;
- rb.isKinematic = true;
- }
- private void OnMouseUp()
- {
- isPressed = false;
- rb.isKinematic = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement