UnityMol  0.9.6-875
UnityMol viewer / In developement
MouseOverMolecule.cs
Go to the documentation of this file.
1 
66 
67 using UnityEngine;
68 using System.Collections;
69 
70 public class MouseOverMolecule : MonoBehaviour {
71 
72  public static bool stopCamera = false;
73  private Camera mainCamera = null;
74 
75  // Use this for initialization
76 
77 
78  // Does something as a response
79  // to the user clicking on the object
80  void OnMouseDrag () {
81  if(Input.GetMouseButton(0)){
82  if(mainCamera == null)
83  mainCamera = Camera.main;
84  maxCamera.cameraStop = true;
85  stopCamera = true;
86  Vector3 p = Input.mousePosition;
87  p.z = mainCamera.WorldToScreenPoint(transform.position).z;
88  transform.position = mainCamera.ScreenToWorldPoint(p);
89  }
90  }
91 
92  void OnMouseUp() {
93  Debug.Log("MouseUp is called now.");
94  maxCamera.cameraStop = false;
95  stopCamera = false;
96  }
97 
98 }
static bool stopCamera
static bool cameraStop
Definition: maxCamera.cs:88