- Home /
Make a box move on mobile by drag (thouching)
Hello
I have this box and falling ball. (all 2d) I want the player to move the box and catch the ball. the box is open from the top. So when the player drags the box it moves so he can catch the ball. I use 2D image with Polygone2d collider (to warp the box border) and Rigibody2D. Currently i can move the box up/down left/right using the arrow keys, but need it to work also by dragging. I have PlayerController.cs script where i control the movment.
Answer by Graham-Dunnett · Jun 18, 2014 at 08:31 AM
You mean, exactly like the first example on the Input.GetTouch()
documentation page?
Actually i want to drag only the box, this script allows me to touch anywhere on the screen which is nice, but I need the object it self to be drag-able by touch. Also when i drag right the object goes left and when i drag up it goes now (all the opposite)
Answer by drorriov · Jun 25, 2014 at 09:30 AM
I managed to make it work. but it causes some colliding problems since i can't control the movement speed with drag.
Does anyone have implantation with rigidbody2D.MovePosition?
Your answer
Follow this Question
Related Questions
Need help on fast and efficient logic of destroying random balls. 0 Answers
Learning Unity 3D and 2D basics 2 Answers
How to Move rigidbody2D on touch ? 1 Answer
Cloud recognition in Vuforia 0 Answers