C# - Drag and then Drop in specified area

眉间皱痕 提交于 2019-12-12 04:30:12

问题


I want my Item / GameObject, that to have its limit of draging. GameObject that have a place to stop, and wont able to use again. Droping Target/ Specified Place to Drop.

  1. First Place of Bed

  2. The bed that have moved. In here, but the bed overlap the chair the should have bump.

  3. This is the bed that i want to end. The bed that can only move from its first place upto the side of the chair.

Im still wondering if it is in some kind of "Vector" code. Im newbie so im still exploring, and also, since its bed, i also want the user to drag the bed a little bit harder like a real person is pulling the big bed, if you know what i mean. If possible.

Code for dragging it. But limitless.

public void OnDrag(PointerEventData eventData)
{
    Debug.Log("OnDrag");
    Vector3 tempPos = this.transform.position;
    tempPos.x = eventData.position.x;
    this.transform.position = tempPos;
}

来源:https://stackoverflow.com/questions/39083167/c-sharp-drag-and-then-drop-in-specified-area

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!