I have written the code for dragging an object.
It works but the thing is the object disappears while it is being dragged.
How can i get it visible on dragging part?
help me guys.
I have written the code for dragging an object.
It works but the thing is the object disappears while it is being dragged.
How can i get it visible on dragging part?
help me guys.
function OnDrag (eventData :PointerEventData)
{
var screenPoint = Vector3(Input.mousePosition.x,Input.mousePosition.y,Input.mousePosition.z);
screenPoint.z = 10.0f;
transform.position = Camera.main.ScreenToWorldPoint(screenPoint);
Debug.Log (Input.mousePosition.x + " " + Input.mousePosition.y +" "+ itemDragged.transform.localPosition);
}
this made it.
If you are dragging a 3D object it may just be a problem of the mouse using different coordinates than things in the 3D “world”. I have had this same problem on many of my projects as well