Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Hareket1 : MonoBehaviour {
- private Vector3 screenPoint ;
- private Vector3 offset;
- void OnMouseDown (){ screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
- offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
- }
- void OnMouseDrag (){ Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
- Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
- transform.position = curPosition;
- }
- void Update () {
- if(Input.touchCount==2) {
- Application.LoadLevel(Application.loadedLevel);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement