Here svaypy NOT NEED.
Yes, and rake, in fact, too ...
You need to block your dragging object on the Y axis.
You need a Drag () implementation — for example, something like this:
using UnityEngine; using System.Collections; [RequireComponent(typeof(BoxCollider2D))] public class Drag : MonoBehaviour { private Vector3 screenPoint; private Vector3 offset; void OnMouseDown() { offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z)); } void OnMouseDrag() { Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z); Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset; transform.position = Vector3.Lerp(transform.position, curPosition, Time.deltaTime); } }
I'm not sure that the code will work as needed, but the idea of the 100% approach should be just that.
Or the implementation of a dredge that will work only on the X axis of the phone screen.
It may also be useful to google by IBeginDragHandler, IDragHandler, IEndDragHandler : IBeginDragHandler, IDragHandler, IEndDragHandler
for more correct implementation.
Movedphase and find out which ones The coordinates flew the touch ... (otherwise it could move along the Y axis) and already do what you want: move it to the same coordinates or just detect a finger movement, but leave the platform speed as before .... for example if the movement is a wheelbarrow it was more than 1.5f (in one direction or another from the place where it was before) - means moving the platform - Alexey Shimansky