drag AND drop push and pull object
hi! so i have a drag to move and object system that moves with my 360 camera. but when i pick up the object it can't go forward and backward. can anyone tell me whats wrong and how to fix it plz.
using UnityEngine; using System.Collections;
public class dragANDdrop : MonoBehaviour {
 private bool dragging = false;
 private float distance;
 void Start() 
 {
     
 }
     
 void OnMouseDown()
 {
     distance = Vector3.Distance(transform.position, Camera.main.transform.position);
     dragging = true;
 }
 void OnMouseUp()
 {
     dragging = false;
 }
 void Update()
 {
     if (dragging)
     {
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         Vector3 rayPoint = ray.GetPoint(distance);
         transform.position = rayPoint;
     }
 }
     
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                