Why is my object flying into the screen when I drag it? It will start off in the correct mouse to world pos correctly, but fly through the screen repeatedly while I hold it to drag. How do I stop making it do that? thanks
function OnMouseDrag(){
var hit: RaycastHit;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, hit)){
gameObject.transform.position = hit.point;
}
}