- Home /
I need code to drag object to specific distance along y axis only?
I want the code to drag handle of a bag to come out along y axis only. I want to drag it using left mouse button. It should come out as I drag it.
Comment
What have you tried. $$anonymous$$ost people don't like to spoon feed code snippets here. You have to try.
I'm trying the code On$$anonymous$$ouseDrag() Below is the code
function On$$anonymous$$ouseDrag(){ var vectorDiff:float=transform.position.y-startPos; //transform.Translate(0,Input.mousePosition.y,0); if(Input.Get$$anonymous$$ouseButtonDown(0)){ if(vectorDiff<2 && handleIn) { transform.position.y+=0.01; print("$$anonymous$$ouse Y "+Input.mousePosition.y); print("Transform "+transform.position.y);
if(vectorDiff>=2){ handleIn=false; } } } }